System.Net.WebProxy.UseDefaultCredentials Property

Gets or sets a bool value that controls whether the CredentialCache.DefaultCredentials are sent with requests.

Syntax

[System.MonoTODO("Does not affect Credentials, since CredentialCache.DefaultCredentials is not implemented.")]
public bool UseDefaultCredentials { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

Set this property to true when requests made by this System.Net.WebProxy 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 WebProxy.Credentials property to the credentials of the client on whose behalf the request is made.

The following table shows the effect of setting the WebProxy.UseDefaultCredentials value, based on the value of the WebProxy.Credentials property.

CredentialCache.DefaultCredentials

true

No effect.

CredentialCache.DefaultCredentials

false

WebProxy.Credentials is set to null.

null

true

WebProxy.Credentials is set to CredentialCache.DefaultCredentials.

Any value other than CredentialCache.DefaultCredentials or null

true or false

Setting WebProxy.UseDefaultCredentials throws an exception.

If WebProxy.UseDefaultCredentials is false, you can change the WebProxy.Credentials property to any credentials. If WebProxy.UseDefaultCredentials is true, changing the WebProxy.Credentials property from CredentialCache.DefaultCredentials (the value that is set when the WebProxy.UseDefaultCredentials property is set to true) will throw an exception.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0