Bagikan melalui


NTLM and Kerberos Authentication

Default NTLM authentication and Kerberos authentication use the Microsoft Windows NT user credentials associated with the calling application to attempt authentication with the server. When using non-default NTLM authentication, the application sets the authentication type to NTLM and uses a NetworkCredential object to pass the user name, password, and domain to the host, as shown in the following example.

Dim MyURI As String = "https://www.contoso.com/"
Dim WReq As WebRequest = WebRequest.Create(MyURI)
WReq.Credentials = _
    New NetworkCredential(UserName, SecurelyStoredPassword, Domain)
String MyURI = "https://www.contoso.com/";
WebRequest WReq = WebRequest.Create (MyURI);
WReq.Credentials = 
    new NetworkCredential(UserName, SecurelyStoredPassword, Domain);

Applications that need to connect to Internet services using the credentials of the application user can do so with the user's default credentials, as shown in the following example.

Dim MyURI As String = "https://www.contoso.com/"
Dim WReq As WebRequest = WebRequest.Create(MyURI)
WReq.Credentials = CredentialCache.DefaultCredentials
String MyURI = "https://www.contoso.com/";
WebRequest WReq = WebRequest.Create (MyURI);
WReq.Credentials = CredentialCache.DefaultCredentials;

The negotiate authentication module determines whether the remote server is using NTLM or Kerberos authentication, and sends the appropriate response.

Note

NTLM authentication does not work through a proxy server.

See Also

Concepts

Basic and Digest Authentication

Internet Authentication