how to do Digest authentification for WebBrowser control

139 views
Skip to first unread message

momonga

unread,
Aug 8, 2010, 8:05:08 AM8/8/10
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
hi!
i'm developing a software that can retrieve the web page and
find a certain button and push it to request the server automatically
for the user.

To do this, i'm planning to use the WebBrowser control.

but the site where i'm trying to get the page, requires me the digest
authentication and cookie.

could you tell me how to get the WebBrowser control to do the digest
authentification.

thanks.

ThanderMaX

unread,
Aug 10, 2010, 3:18:32 AM8/10/10
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
First of all I don't know how to do that via WebBrowser control (I
couldn't find any interface or method to do that, only I can see
WebBrowser.EncryptionLevelChanged Event)

But Wikipedia seems to have an easier explanation of digest
authentication. http://en.wikipedia.org/wiki/Digest_access_authentication
which I think can be done manually via HttpWebRequest .

or another simple way (from MSDN):
CredentialCache myCache = new CredentialCache();

myCache.Add(new Uri("http://www.contoso.com/"),"Basic",new
NetworkCredential(UserName,SecurelyStoredPassword));
myCache.Add(new Uri("http://www.contoso.com/"),"Digest", new
NetworkCredential(UserName,SecurelyStoredPassword,Domain));

wReq.Credentials = myCache;


Posting Form data can be done manually, without WebBrowser control.




Let's see what others are saying ..

ThanderMaX

unread,
Aug 10, 2010, 3:19:36 AM8/10/10
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting

momonga

unread,
Aug 10, 2010, 6:40:05 AM8/10/10
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
hi!
thanks for replying.

I need to analyze the web page to find the parts such like an editbox,
or buttons.
and the only way I know to parse was the way to use the WebBrowser
control's HtmlDocument.

I can't believe that there is no way to access the site with digest
auth via the WebControl.
but, I also can't find any possible methods or events too.
Do I need to make the hash and nonce and set it to the HTTP header
directly?
Any way, the way seems to be too difficult for me(^^;).

Is there any trendy ways to parse the html obtained via the
HttpWebRequest(and the family functions)?

The only way I have found is to use the mshtml's HTMLDocument.
but I have not tried it yet.
I'm going to try it in the next few days.




Reply all
Reply to author
Forward
0 new messages