HttpWebRequest.UseDefaultCredentials Property

Definition

Gets or sets a Boolean value that controls whether default credentials are sent with requests.

public override bool UseDefaultCredentials { get; set; }

Property Value

true if the default credentials are used; otherwise, false. The default value is false.

Exceptions

You attempted to set this property after the request was sent.

Remarks

Ettevaatust!

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

Set this property to true when requests made by this HttpWebRequest 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 middle-tier applications, such as ASP.NET applications, 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.

Applies to

Toode Versioonid
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0