Freigeben über


WebProxy-Konstruktor (String, Boolean)

Initialisiert eine neue Instanz der WebProxy-Klasse mit dem angegebenen URI und der angegebenen Umgehungseinstellung.

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

Syntax

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

Dim instance As New WebProxy(Address, BypassOnLocal)
public WebProxy (
    string Address,
    bool BypassOnLocal
)
public:
WebProxy (
    String^ Address, 
    bool BypassOnLocal
)
public WebProxy (
    String Address, 
    boolean BypassOnLocal
)
public function WebProxy (
    Address : String, 
    BypassOnLocal : boolean
)

Parameter

  • Address
    Der URI des Proxyservers.
  • BypassOnLocal
    true, um den Proxy bei lokalen Adressen zu umgehen, andernfalls false.

Ausnahmen

Ausnahmetyp Bedingung

UriFormatException

Address ist ein ungültiger URI.

Hinweise

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

Beispiel

Im folgenden Codebeispiel wird das Aufrufen dieses Konstruktors veranschaulicht.

public static WebProxy CreateProxyWithHostAddress(bool bypassLocal)
{
    WebProxy proxy =  new WebProxy("http://contoso", bypassLocal);
    Console.WriteLine("Bypass proxy for local URIs?: {0}", 
       proxy.BypassProxyOnLocal);
    return proxy;
}
WebProxy^ CreateProxyWithHostAddress( bool bypassLocal )
{
   WebProxy^ proxy = gcnew WebProxy( "http://contoso",bypassLocal );
   Console::WriteLine( "Bypass proxy for local URIs?: {0}", 
      proxy->BypassProxyOnLocal );
   return proxy;
}
public static WebProxy CreateProxyWithHostAddress(boolean bypassLocal)
{
    WebProxy proxy = new WebProxy("http://contoso", bypassLocal);
    Console.WriteLine("Bypass proxy for local URIs?: {0}", 
        (System.Boolean)proxy.get_BypassProxyOnLocal());
    return proxy;
} //CreateProxyWithHostAddress

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

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

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