Share via


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 der Internetoptionen.

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 instance, die die nicht dynamischen Proxyeinstellungen aus Internetoptionen enthält.

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 nicht dynamischen Proxyeinstellungen aus den Internetoptionen des Computers und erstellt eine WebProxy instance mit diesen Einstellungen.

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: