The following article explains how to handle HTTP authentication in DotNetBrowser:
https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110052-handling-basic-digest-and-ntlm-authentication
In two words, it is necessary to implement and register a custom implementation of the NetworkDelegate
interface in order to provide user name and password when necessary. For example:
public class CustomNetworkDelegate : DefaultNetworkDelegate
{
public bool OnAuthRequired(AuthRequiredParams parameters)
{
if (!parameters.IsProxy) {
parameters.Username = "proxy-username";
parameters.Password = "proxy-password";
// Don't cancel authentication
return false;
}
// Cancel authentication
return true;
}
}
This implementation is then registered as shown below:
browserView.Browser.Context.NetworkService.NetworkDelegate = new CustomNetworkDelegate();
It is possible to show the dialog or to handle authentication in the application code directly. You can also register the existing implementations (WinFormsDefaultNetworkDelegate
or WPFDefaultNetworkDelegate
) that contain ready-to-use authentication dialogs.