Freigeben über


WebProxy-Konstruktor (String, Boolean, String , ICredentials)

Initialisiert eine neue Instanz der WebProxy-Klasse mit dem angegebenen URI, der angegebenen Umgehungseinstellung, der Liste der zu umgehenden URIs und den Anmeldeinformationen.

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

Syntax

'Declaration
Public Sub New ( _
    Address As String, _
    BypassOnLocal As Boolean, _
    BypassList As String(), _
    Credentials As ICredentials _
)
'Usage
Dim Address As String
Dim BypassOnLocal As Boolean
Dim BypassList As String()
Dim Credentials As ICredentials

Dim instance As New WebProxy(Address, BypassOnLocal, BypassList, Credentials)
public WebProxy (
    string Address,
    bool BypassOnLocal,
    string[] BypassList,
    ICredentials Credentials
)
public:
WebProxy (
    String^ Address, 
    bool BypassOnLocal, 
    array<String^>^ BypassList, 
    ICredentials^ Credentials
)
public WebProxy (
    String Address, 
    boolean BypassOnLocal, 
    String[] BypassList, 
    ICredentials Credentials
)
public function WebProxy (
    Address : String, 
    BypassOnLocal : boolean, 
    BypassList : String[], 
    Credentials : ICredentials
)

Parameter

  • Address
    Der URI des Proxyservers.
  • BypassOnLocal
    true, um den Proxy bei lokalen Adressen zu umgehen, andernfalls false.
  • BypassList
    Ein Array von Zeichenfolgen regulärer Ausdrücke mit den URIs der zu umgehenden Server.
  • Credentials
    Eine für die Authentifizierung an den Proxyserver zu sendende ICredentials-Instanz.

Ausnahmen

Ausnahmetyp Bedingung

UriFormatException

Address ist ein ungültiger URI.

Hinweise

Beim Initialisieren der WebProxy-Eigenschaft wird die Address-Eigenschaft auf eine Uri-Instanz mit Address, die BypassProxyOnLocal-Eigenschaft auf BypassOnLocal, die BypassList-Eigenschaft auf BypassList und die Credentials-Eigenschaft auf Credentials festgelegt.

Beispiel

Im folgenden Codebeispiel wird das Aufrufen dieses Konstruktors veranschaulicht.

public static WebProxy CreateProxyWithCredentials(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy("http://contoso", 
        bypassLocal, 
        bypassList,
        CredentialCache.DefaultCredentials);
}
WebProxy^ CreateProxyWithCredentials( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( "http://contoso",
      bypassLocal,
      bypassList,
      CredentialCache::DefaultCredentials );
}
public static WebProxy CreateProxyWithCredentials(boolean bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    String bypassList[] = new String[] { ";*.Contoso.com" };
    return new WebProxy("http://contoso", bypassLocal, bypassList, 
        CredentialCache.get_DefaultCredentials());
} //CreateProxyWithCredentials

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

WebProxy-Klasse
WebProxy-Member
System.Net-Namespace
BypassProxyOnLocal
BypassList