Export (0) Print
Expand All

WebProxy.Credentials Property

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

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

public ICredentials Credentials { get; set; }
/** @property */
public final ICredentials get_Credentials ()

/** @property */
public final void set_Credentials (ICredentials value)

public final function get Credentials () : ICredentials

public final function set Credentials (value : ICredentials)

Not applicable.

Property Value

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

Exception typeCondition

InvalidOperationException

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

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.

NoteNote:

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 a null reference (Nothing in Visual Basic) before setting the UseDefaultCredentials property to true. Likewise, you cannot set this property to any value when UseDefaultCredentials is true.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, 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, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft