Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Hi,

I´d like to implement Basic and Digest authentication for a webbrowser
control in my C# application.

For Basic authentication i´ve already found a solution, which uses an
additional header:
string hdr = "Authorization: BASIC " + Convert.ToBase64String(Encoding.ASCII.GetBytes(uname + ":" + pwd)) + " " + System.Environment.NewLine;
webBrowser1.Navigate(url, null, null, hdr);


But for Digest authentication there are only some solutions which demonstrate how to use with web requests.

WebClient webcli = new WebClient();
CredentialCache authcache = new CredentialCache();
authcache.Add(new Uri(url), "Digest", new NetworkCredential(uname,
pwd));
webcli.Credentials = authcache;
string results =
System.Encoding.UTF8.GetString(webcli.DownloadData(url));



Is there a way to implement this for the webbrowser control?
A code snippet would be greatly appreciated.

Thanks,
Tony
Posted
Updated 31-May-11 22:19pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900