[2005] WebBrowser Credentials
so I've started using the Webbrowser control, and I've got it doing most of what I want (a button takes them straight to the correct page on the correct site, it's filling in text boxes, will fill out more once I get to that step).
However when I go to the particular secure site my users are supposed to login to, it brings up what I assume is a windows domain login prompt with a check box to save the userid/password.
Saving the password is not allowed for this secure site, and when I use system.webclient to get the first page so I can use my own windows for getting the login info, it doesn't carry over the authentication info to the webbrowser if I let it go back to using the web browser's default navigation methods, nor does it load the images or the page properly.
I was thinking I needed to set the webbrowser's credentials, but I can't find anything exposed to make changes to or override if I try to inherit.
i'm behind a webproxy, and the site itself requires login. I've figured out in code how to pull back secure pages that require you to be logged in, but when I pass that html up to the webbrowser it doesn't know how to access or load the images or other things that the html instructs it to do.
Re: [2005] WebBrowser Credentials
Anyone have any ideas on this one?
Re: [2005] WebBrowser Credentials
I wrote an extended browser control that can pass credentials to the web server and avoid the prompt all together. (For that exact windows domain login prompt) I will see if I can get together the code in an example and post it for you.
Re: [2005] WebBrowser Credentials
Thanks, I was hoping you would weigh in on this one
1 Attachment(s)
Re: [2005] WebBrowser Credentials
Here is the example app.
I had to sort of piece it together from a bigger project where I used the code previously, but I tested it in this project and it works. It should be self explanitory. Also the extended browser control class I made provides NewWindow2 and NavigateError events, 2 important events that the standard browser is missing. More on that info can be found here
However note that the download in that link in that article is not the same as the one I am giving you now. The one I am giving you now is the only one with the IAuthenticate interface code implemented. I also did it in VS2005 since it looks like that is what you have.
Re: [2005] WebBrowser Credentials
Hi All,
So here is my first post on the forums. I hope it's OK that I reply to an old post. I was having the same issue with the credentials and the sample provided worked great for me, but since I use this extended version of the control I cannot get the external communication working.
What i mean is that I can not access any public functions from the class defined in WebBrowerEx.ObjectForScripting. for example onclick="window.external.MySampleMethod()" results in the following error:
object does not support this property or method.
Some additional information:
I'm using VB.NET in VS 2008 with framework 3.5sp1 installed.
I'm able to invoke client scripting from my class e.g.
WebBrowser1.Document.InvokeScript("doSomeThing", New String() {_myVariableToPass}"). works fine.
What i'm basically trying to do is open a modaldialog window from my client app where the user can select a value, this value needs to be passed back to the app.
This is realized by loading a html page into the webbrowser control (lets call this page handler.htm). This handler.htm page opens a modal dialog. The user selects an item , the returnvalue of the modaldialog is set to the id of the selected item. Handler.htm hold the value in a variable and now should call window.external.RetrieveValue. That's where the error occurs.
The class registred in ObjectForScripting is marked public. The following modifiers are applied :
<PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
<System.Runtime.InteropServices.ComVisibleAttribute(True)> _
Without the interfaces in the post above all works fine, except i do not have the authentication.
Is there anybody who can help me out and tell me what goes wrong? I'd really appriciate it.
If there are any suggestions for another way to handle the described scenario, i'd like to hear so.