WebProxy.GetDefaultProxy Methode

Definition

Achtung

This method has been deprecated. Please use the proxy selected for you by default. https://go.microsoft.com/fwlink/?linkid=14202

Achtung

WebProxy.GetDefaultProxy has been deprecated. Use the proxy selected for you by default.

Achtung

This method has been deprecated. Please use the proxy selected for you by default. http://go.microsoft.com/fwlink/?linkid=14202

Liest die nicht dynamischen Proxyeinstellungen von Internet Explorer.

public:
 static System::Net::WebProxy ^ GetDefaultProxy();
[System.Obsolete("This method has been deprecated. Please use the proxy selected for you by default. https://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.WebProxy GetDefaultProxy ();
[System.Obsolete("WebProxy.GetDefaultProxy has been deprecated. Use the proxy selected for you by default.")]
public static System.Net.WebProxy GetDefaultProxy ();
[System.Obsolete("This method has been deprecated. Please use the proxy selected for you by default. http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Net.WebProxy GetDefaultProxy ();
public static System.Net.WebProxy GetDefaultProxy ();
[<System.Obsolete("This method has been deprecated. Please use the proxy selected for you by default. https://go.microsoft.com/fwlink/?linkid=14202")>]
static member GetDefaultProxy : unit -> System.Net.WebProxy
[<System.Obsolete("WebProxy.GetDefaultProxy has been deprecated. Use the proxy selected for you by default.")>]
static member GetDefaultProxy : unit -> System.Net.WebProxy
[<System.Obsolete("This method has been deprecated. Please use the proxy selected for you by default. http://go.microsoft.com/fwlink/?linkid=14202")>]
static member GetDefaultProxy : unit -> System.Net.WebProxy
static member GetDefaultProxy : unit -> System.Net.WebProxy
Public Shared Function GetDefaultProxy () As WebProxy

Gibt zurück

Eine WebProxy-Instanz mit den nicht dynamischen Proxyeinstellungen von Internet Explorer 5.5 und höher.

Attribute

Ausnahmen

Beispiele

Im folgenden Codebeispiel wird das Aufrufen dieser Methode veranschaulicht.

void CheckDefaultProxyForRequest( Uri^ resource )
{
   WebProxy^ proxy = (WebProxy^)( WebProxy::GetDefaultProxy() );
   
   // See what proxy is used for resource.
   Uri^ resourceProxy = proxy->GetProxy( resource );
   
   // Test to see whether a proxy was selected.
   if ( resourceProxy == resource )
   {
      Console::WriteLine( "No proxy for {0}", resource );
   }
   else
   {
      Console::WriteLine( "Proxy for {0} is {1}", resource, 
         resourceProxy );
   }
}
public static void CheckDefaultProxyForRequest(Uri resource)
{
    WebProxy proxy = (WebProxy) WebProxy.GetDefaultProxy();

    // See what proxy is used for resource.
    Uri resourceProxy = proxy.GetProxy(resource);

    // Test to see whether a proxy was selected.
    if (resourceProxy == resource)
    {
        Console.WriteLine("No proxy for {0}", resource);
    }
    else
    {
        Console.WriteLine("Proxy for {0} is {1}", resource.ToString(),
            resourceProxy.ToString());
    }
}

Hinweise

Die GetDefaultProxy Methode liest die vom Internet Explorer 5.5 und höher gespeicherten nicht dynamischen Proxyeinstellungen und erstellt mit diesen Einstellungen eine WebProxy instance.

Die GetDefaultProxy Methode übernimmt keine dynamischen Einstellungen, die aus Skripts generiert werden, die von Internet Explorer, automatischen Konfigurationseinträgen oder DHCP- oder DNS-Nachschlagevorgängen ausgeführt werden.

Anwendungen sollten die HttpClient.DefaultProxy -Eigenschaft anstelle der GetDefaultProxy -Methode verwenden.

Hinweis

Diese Eigenschaft wird unter .NET Core nicht unterstützt.

Gilt für: