AuthenticationManager.CredentialPolicy Property

Gets or sets the credential policy to be used for resource requests made using the HttpWebRequest class.

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

Public Shared Property CredentialPolicy As ICredentialPolicy
Dim value As ICredentialPolicy

value = AuthenticationManager.CredentialPolicy

AuthenticationManager.CredentialPolicy = value
/** @property */
public static ICredentialPolicy get_CredentialPolicy ()

/** @property */
public static void set_CredentialPolicy (ICredentialPolicy value)

public static function get CredentialPolicy () : ICredentialPolicy

public static function set CredentialPolicy (value : ICredentialPolicy)

Not applicable.

Property Value

An object that implements the ICredentialPolicy interface that determines whether credentials are sent with requests. The default value is a null reference (Nothing in Visual Basic).

The credential policy determines whether to send credentials when sending a request for a network resource, such as the content of a Web page. If credentials are sent, servers that require client authentication can attempt to authenticate the client when the request is received instead of sending a response indicating that the client's credentials are required. While this saves a round trip to the server, this must be balanced against the security risk inherent in sending credentials across the network. When the destination server does not require client authentication it is best to not send credentials.

The credential policy will be called only for requests that specify credentials or use a WebProxy object that specifies credentials.

The following code example demonstrates setting the credential policy.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0