Freigeben über


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

Initialisiert eine neue Instanz der WebProxy-Klasse mit der angegebenen Uri-Instanz, 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 Uri, _
    BypassOnLocal As Boolean, _
    BypassList As String(), _
    Credentials As ICredentials _
)
'Usage
Dim Address As Uri
Dim BypassOnLocal As Boolean
Dim BypassList As String()
Dim Credentials As ICredentials

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

Parameter

  • Address
    Eine Uri-Instanz mit der Adresse 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.

Hinweise

Beim Initialisieren der WebProxy-Instanz wird die Address-Eigenschaft auf 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 CreateProxyWithCredentials2(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy(new Uri("http://contoso"), 
        bypassLocal, 
        bypassList,
        CredentialCache.DefaultCredentials);
}
WebProxy^ CreateProxyWithCredentials2( bool bypassLocal )
{
   
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( gcnew Uri( "http://contoso" ),
      bypassLocal,
      bypassList,
      CredentialCache::DefaultCredentials );
}
public static WebProxy CreateProxyWithCredentials2(boolean bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    String bypassList[] = new String[] { ";*.Contoso.com" };
    return new WebProxy(new Uri("http://contoso"), bypassLocal, 
        bypassList, CredentialCache.get_DefaultCredentials());
} //CreateProxyWithCredentials2

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