This documentation is archived and is not being maintained.

AuthenticationManager::PreAuthenticate Method

Preauthenticates a request.

Namespace:  System.Net
Assembly:  System (in System.dll)

static Authorization^ PreAuthenticate(
	WebRequest^ request, 
	ICredentials^ credentials


Type: System.Net::WebRequest

A WebRequest to an Internet resource.

Type: System.Net::ICredentials

The ICredentials associated with the request.

Return Value

Type: System.Net::Authorization
An instance of the Authorization class if the request can be preauthenticated; otherwise, nullptr. If credentials is nullptr, this method returns nullptr.


request is nullptr.

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.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0