Aracılığıyla paylaş


WebProxy.GetDefaultProxy Yöntem

Tanım

Dikkat

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

Dikkat

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

Dikkat

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

İnternet seçenekleri dinamik olmayan ara sunucu ayarlarını okur.

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

Döndürülenler

WebProxy İnternet seçeneklerinden dinamik olmayan ara sunucu ayarlarını içeren bir örnek.

Öznitelikler

Özel durumlar

Örnekler

Aşağıdaki kod örneğinde bu yöntemin çağrılması gösterilmektedir.

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());
    }
}

Açıklamalar

yöntemi bilgisayarın GetDefaultProxy İnternet seçeneklerinden dinamik olmayan ara sunucu ayarlarını okur ve bu ayarlarla bir WebProxy örnek oluşturur.

yöntemi, GetDefaultProxy Internet Explorer tarafından çalıştırılan betiklerden, otomatik yapılandırma girişlerinden veya DHCP veya DNS aramalarından oluşturulan dinamik ayarları almaz.

Uygulamalar yöntemi yerine GetDefaultProxy özelliğini kullanmalıdırHttpClient.DefaultProxy.

Not

Bu özellik .NET Core'da desteklenmez.

Şunlara uygulanır