Condividi tramite


WebRequest.UseDefaultCredentials Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When overridden in a descendant class, gets or sets a Boolean value that controls whether default credentials are sent with requests.

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

Syntax

'Declaration
Public Overridable Property UseDefaultCredentials As Boolean
public virtual bool UseDefaultCredentials { get; set; }

Property Value

Type: System.Boolean
true if the default credentials are used; otherwise false. For requests created using the default BrowserHttp stack, the default value is true. For requests created using the ClientHttp stack, the default value is false.

Exceptions

Exception Condition
NotImplementedException

This property is not implemented.

Remarks

Set this property to true when requests made by this WebRequest object should, if requested by the server, be authenticated using the credentials of the currently logged on user. For client applications, this is the desired behavior in most scenarios. For applications that wish to control the authentication user experience, instead of using this property you would typically set the Credentials property to the credentials of the client on whose behalf the request is made.

The property is applicable to client HTTP handling for ClientHttp and does not apply to browser HTTP handling for BrowserHttp.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.