Using axWebBrowser in a C# form

  • Thread starter Thread starter Gilgamesh
  • Start date Start date
G

Gilgamesh

Hi there,

I'm trying to use axWebBrowser component, in a C# form, to connect to a web
server which requires Windows Basic authentication to login. Does anybody
know how to pass the logins to the axWebBrowser so it won't display a dialog
box to the user in order to enter the logins?

Thanks a bunch,
Gilgamesh
 
Hi Gilgamesh
You can use the default credentials object then send that to a proxy
s.Credentials = System.Net.CredentialCache.DefaultCredentials;
Default credentials get the credentials of the user logged on ( in windows
applications ) and it web it get those that the web application is running
under

Or you can create your own net credentials object
System.Net.NetworkCredential myCred = System.Net.NetworkCredential;
System.Net.NetworkCredential(txtuserid.Text,txtpassword.Text,txtdomain.Text)
;
System.Net.CredentialCache myCache = new System.Net.CredentialCache();
myCache.Add(new Uri(s.Url), txttype.Text, myCred);

MessageBox.Show(WindowsIdentity.GetCurrent().Name);
MessageBox.Show(WindowsIdentity.GetCurrent().IsAnonymous.ToString());
Hope that helps
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
Hi Mohamed,

I see how you're creating the required credentials, but I don't see how you
force axWebBrwoser to use this credentials.

Thanks,
Gilgamesh
 
Back
Top