- request
- A System.Net.WebRequest to an Internet resource.
- credentials
- The System.Net.ICredentials associated with the request.
An instance of the System.Net.Authorization class if the request can be preauthenticated; otherwise, null. If credentials is null, this method returns null.
Type Reason ArgumentNullException request is null.
If the authentication module can preauthenticate the request, the AuthenticationManager.PreAuthenticate(WebRequest, ICredentials) method returns an Authentication instance and sends the authorization information to the server preemptively instead of waiting for the resource to issue a challenge. This behavior is outlined in section 3.3 of RFC 2617 (HTTP Authentication: Basic and Digest Access Authentication). Authentication modules that support preauthentication allow clients to improve server efficiency by avoiding extra round trips caused by authentication challenges.
Authorization modules that can preauthenticate requests set the IAuthenticationModule.CanPreAuthenticate property to true.