RE: How to tell WebBrowser control what credentials to use?



Hi Linda (and all),

Sorry, we seam to be misunderstanding each other.

Let me try and re-state my problem/question.

I have a WinForms application that contains the WebBrowser control.
This WebBrowser control needs to access a web application (web site)
that requires authentication. I want the navigation to the web application
and the login process to happen without end-user intervention (automatically).

If I were to use WebRequest / WebResponse to access that same web site
I would use something like:

// Create a request for the URL.
WebRequest request =
WebRequest.Create ("http://www.contoso.com/default.html";);

// If required by the server, set the credentials.
// or use a different ICredentials implementation
request.Credentials = CredentialCache.DefaultCredentials;
// Or something with specific username and password like
request.Credentials =
new NetworkCredential("UserName", "SecurelyStoredPassword")

// Call the site using the specified credentials.
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();


How would I do the equivalent if I am using WebBrowser control instead of
the WebRequest / WebResponse?

How do I supply the WebBrowser control the credentials to use when accessing
the web site.

(As you can see from the scenario I describe, I have no control over the
HTML or the script that comes from the web site.)

Thanks,

---
Adar Wesley

---
Adar Wesley



"Linda Liu [MSFT]" wrote:

Hi Adar,

After doing some research on this issue, I only find a way for a client
application code to communicate with a web page scripting code. We could
call the functions in the web page script code from our client application,
and access the public propeties and methods defined in our client
application from the web page script code.

I think you may add a function to accept username and password in the
script code of the web page. Then call this function from the client
application to pass the stored username and password. You may modify the
logon logic in the web page to use the username and password that has been
passed.

For more information on how to implement two-way communication between
DHTML code and client application code, you could refer to the following
page.

http://msdn2.microsoft.com/en-us/library/a0746166.aspx

Hope this helps.


Sincerely,
Linda Liu
Microsoft Online Community Support



.



Relevant Pages

  • Re: upgradability concern
    ... client using a WebBrowser control via COM interop, ... There are ways to explicitly implement COM interfaces ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Get client name
    ... i've understand that the netbiosname of the client is not accessble by ... > to a smart client winforms app so that you can: ... > - Use your existing asp.net by having a webbrowser control on the ... >>bye Maurizio ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: parsing data returned from Microsoft.XMLHTTP
    ... Could you elaborate on the WebBrowser control? ... Tom van Stiphout wrote: ... use the DOM to get to what I want. ... from a web site. ...
    (comp.databases.ms-access)
  • Re: Opening URL?
    ... >>>the web site in the webbrowser control. ... For example, a toolbar with navigation buttons, etc. ...
    (microsoft.public.vb.general.discussion)
  • Webbrowser Control and Sessions
    ... I am writing an app where people will be hitting a client web site to fill ... The app is using the webbrowser control to navigate to ... the VB app and restarting it), the session stays from phone call to phone ...
    (microsoft.public.vb.controls.internet)