To handle basic, digest or NTLM authentication you can use the NetworkDelegate.OnAuthRequired(AuthRequiredParams params) handler.


To display authentication dialog where user can enter valid user name and password you can register default WPF/WinForms implementation of the NetworkDelegate  (WinFormsDefaultNetworkDelegate  or WPFDefaultNetworkDelegate )  or your own implementation of the NetworkDelegate interface.


The following example demonstrates how to register and override default implementation of the NetworkDelegate interface in order to provide user name and password without displaying authorization dialog:

С#

public class CustomNetworkDelegate : DefaultNetworkDelegate 
{
    public override 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;
    }
}


browserView.Browser.Context.NetworkService.NetworkDelegate = new CustomNetworkDelegate();


VB.NET

Public Class CustomNetworkDelegate
    Inherits DefaultNetworkDelegate

    Public Overrides Function OnAuthRequired(ByVal parameters As AuthRequiredParams) As Boolean
        If Not parameters.IsProxy Then
            parameters.Username = "proxy-username"
            parameters.Password = "proxy-password"
            ' Don't cancel authentication
            Return False
        End If

        ' Cancel authentication
        Return True
    End Function
End Class


browserView.Browser.Context.NetworkService.NetworkDelegate = New CustomNetworkDelegate()


To specify which servers should be whitelisted for the NTLM authentication use the approach described in this article: HTTP Server Whitelist