Export (0) Print
Expand All

AuthenticationManager.PreAuthenticate Method

Preauthenticates a request.

[Visual Basic]
Public Shared Function PreAuthenticate( _
   ByVal request As WebRequest, _
   ByVal credentials As ICredentials _
) As Authorization
public static Authorization PreAuthenticate(
 WebRequest request,
 ICredentials credentials
public: static Authorization* PreAuthenticate(
 WebRequest* request,
 ICredentials* credentials
public static function PreAuthenticate(
   request : WebRequest,
 credentials : ICredentials
) : Authorization;


A WebRequest to an Internet resource.
The ICredentials associated with the request.

Return Value

An instance of the Authorization class if the request can be preauthenticated; otherwise, a null reference (Nothing in Visual Basic). If credentials is a null reference (Nothing), this method returns a null reference (Nothing).


Exception Type Condition
ArgumentNullException request is null.


If the authentication module can preauthenticate the request, the PreAuthenticate 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.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

AuthenticationManager Class | AuthenticationManager Members | System.Net Namespace

© 2015 Microsoft