Jump to content

IECreateEmbedded and password dialog


rvdmast
 Share

Recommended Posts

I'm building a small app that uses an embedded IE control to connect to an intranet page. Everything works except that i can't get it to display the username/password dialog on a web page that requires authentication?

Instead of displaying IE's built in password dialog and continuing after authentication, it gives a "page cannot be found". When i browse to that page with IE (not embedded) it works as expected.

here is the relevant code:

CODE
$oIE = _IECreateEmbedded ()

GUICreate("Wachtwoord Reset", $Width, $Height, $Left, $Top, $WS_EX_DLGMODALFRAME )

GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked")

$GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, $Width - 5, $Height - 10)

GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKTOP)

GUISetState() ;Show GUI

_IENavigate ($oIE, $URL)

Is this a (known) limitation of the embedded IE control?

Link to comment
Share on other sites

Without supplying a reproducer you'll need to provide a much more detailed description of the behaviour. There is no inherent restriction of an embedded browser control that I am aware of.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I would provide the complete source code but i'd have to tell you the URL to our company's

password reset page (for users who forget their password) to make it work. Not sure it would be wise to post that here.

Besides there really isn't much more code to it then what i've shown.

So without posting the URL here, here's the complete code:

CODE
include <GUIConstants.au3>

#include <IE.au3>

Opt("GUIOnEventMode", 1)

Opt("TrayIconHide", 1)

_IEErrorHandlerRegister ()

$Width = 600

$Height = 432

$Left = (@DesktopWidth-600)/2

$Top = (@DesktopHeight-$Height-32)

If FileExists(@ScriptDir & "\pwreset.ini") Then

$URL = IniRead ( @ScriptDir & "\pwreset.ini", "PageURL", "URL","")

If $URL = "" Then

$URL = InputBox ( "Enter URL", "Enter the URL:" )

$Success = IniWrite ( @ScriptDir & "\pwreset.ini", "PageURL", "URL",$URL)

If $Success = 0 Then

MsgBox(0, "Error", "Unable to open/write " & @ScriptDir & "\pwreset.ini")

Exit

EndIf

EndIf

Else

$file = FileOpen(@ScriptDir & "\pwreset.ini", 9)

If $file = -1 Then

MsgBox(0, "Error", "Unable to create "& @ScriptDir & "\pwreset.ini")

Exit

EndIf

FileClose($file)

If $URL = "" Then

$URL = InputBox ( "Enter URL", "Enter the URL:" )

$Success = IniWrite ( @ScriptDir & "\pwreset.ini", "PageURL", "URL",$URL)

If $Success = 0 Then

MsgBox(0, "Error", "Unable to open/write " & @ScriptDir & "\pwreset.ini")

Exit

EndIf

EndIf

EndIf

$oIE = _IECreateEmbedded ()

GUICreate("Wachtwoord Reset", $Width, $Height, $Left, $Top, $WS_EX_DLGMODALFRAME )

GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked")

$GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, $Width - 5, $Height - 10)

GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKTOP)

GUISetState() ;Show GUI

_IENavigate ($oIE, $URL)

While 1

Sleep (1000)

WEnd

Func CloseClicked()

Exit

EndFunc

GUIDelete()

Exit

Anyway, i found that when using _IECreate() instead of _IECreateEmbedded () it does show the login dialog as expected. So now i'm using that and make sure IE starts in kiosk(theater)mode to hide the adressbar etc...

Link to comment
Share on other sites

So again, without the URL you have not provided a reproducer, so I can only guess what you are talking about. That is why I asked you to provide a more detailed description of the behaviour.

For example, I'm unclear about what this means:

i can't get it to display the username/password dialog on a web page

username/password are handled in many different ways, so you need to explain much more precisely.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Click on either the "Ik wil mij nu registreren. " link or the

"Ik wil mijn gegevens wijzigen. " either one will ask you for a password

( a IIS/NT authentication)

btw i will be deleting the URL here afterwards it's really not everyone's bussines

Anyway thanks for your time thus far!

So again, without the URL you have not provided a reproducer, so I can only guess what you are talking about. That is why I asked you to provide a more detailed description of the behaviour.

For example, I'm unclear about what this means: username/password are handled in many different ways, so you need to explain much more precisely.

Dale

Edited by GaryFrost
removed url
Link to comment
Share on other sites

I really wasn't pressuring you for the URL, a more precise description of the problem would do.

Opening the site in IE it does not "display the username/password dialog on a web page" as you stated, but rather pops up a Win32 dialog box prompting for Username and Password. This is why I was pushing for a more precise description of the issue.

I do recall some discussion about this a long time ago, but don't recall the resolution. There are definitely some differences between the InternetExplorer and the WebBrowser controls, having nothing to do with AutoIt and it is likely this is one of them. Some searching in MSDN may uncover something, but I was unable to find anything after searching for a few minutes. I wish I had an answer for you, but I don't.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

this is the URL of the site, [

<redacted>

Click on either the "Ik wil mij nu registreren. " link or the

"Ik wil mijn gegevens wijzigen. " either one will ask you for a password

( a IIS/NT authentication)

btw i will be deleting the URL here afterwards it's really not everyone's bussines

Anyway thanks for your time thus far!

The relevant part is here:

<h3><a href="\register\register.asp">Ik wil mij nu registreren. </a></h3>
<h3><a href="\reset\reset.asp">Ik wil mijn wachtwoord resetten. </a></h3>
<h3><a href="\update\index.asp">Ik wil mijn gegevens wijzigen. </a></h3>

The links simply launch an .asp page that kicks a standard login dialog window.

I was able to reproduce your symptoms with this:

#include <GuiConstants.au3>
#include <IE.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 640, 480)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$oIE = _IECreateEmbedded()
$CtrlIE = GUICtrlCreateObj($oIE, 10, 10, 620, 460)
GUISetState()
_IENavigate($oIE, "https://<redacted>")

While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

I manually clicked on the link "Ik wil mij nu registreren."

The login popup works externally, but not as an embedded control.

:)

Edit: Removed URL incase you wanted to remove it from the post replied to...

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Now how can i edit my post to remove the URL...can't seem to find an edit button?

I reported post #6 to the Moderators. They can do it for you. After a certain number of posts (don't remember how many) you'd be able to do it yourself.

Merry Christmas!

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...