WebProxy.Credentials Property

Definition

Gets or sets the credentials to submit to the proxy server for authentication.

public:
 property System::Net::ICredentials ^ Credentials { System::Net::ICredentials ^ get(); void set(System::Net::ICredentials ^ value); };
public System.Net.ICredentials? Credentials { get; set; }
public System.Net.ICredentials Credentials { get; set; }
member this.Credentials : System.Net.ICredentials with get, set
Public Property Credentials As ICredentials

Property Value

An ICredentials instance that contains the credentials to submit to the proxy server for authentication.

Implements

Exceptions

You attempted to set this property when the UseDefaultCredentials property was set to true.

Remarks

The Credentials property contains the authentication credentials to send to the proxy server in response to an HTTP 407 (proxy authorization) status code. In most client scenarios, you should use the DefaultCredentials, which are the credentials of the currently logged on user. To do this, set the UseDefaultCredentials property to true instead of setting this property.

Note

If you set the Credentials property to credentials other than the DefaultCredentials, setting the UseDefaultCredentials property to true causes a InvalidOperationException. To prevent this, you must set the Credentials property to null before setting the UseDefaultCredentials property to true. Likewise, you cannot set this property to any value when UseDefaultCredentials is true.

Applies to