WebProxy.GetDefaultProxy メソッド

定義

注意事項

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

注意事項

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

注意事項

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

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

戻り値

Internet Explorer 5.5 以降からの非動的なプロキシ設定を格納する WebProxy インスタンス。

属性

例外

.NET Core の場合。

次のコード例では、このメソッドの呼び出しを示します。

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

注釈

メソッドは GetDefaultProxy 、Internet Explorer 5.5 以降によって格納されている非動的プロキシ設定を読み取り、それらの設定でインスタンスを WebProxy 作成します。

メソッドは GetDefaultProxy 、Internet Explorer によって実行されるスクリプト、自動構成エントリ、DHCP または DNS 参照から生成された動的設定を取得しません。

アプリケーションでは、 メソッドの代わりに プロパティを使用 HttpClient.DefaultProxy する GetDefaultProxy 必要があります。

注意

このプロパティは、.NET Core ではサポートされていません。

適用対象