WebProxy コンストラクター

定義

WebProxy クラスの新しいインスタンスを初期化します。

オーバーロード

WebProxy()

WebProxy クラスの空のインスタンスを初期化します。

WebProxy(String, Boolean, String[], ICredentials)

指定した URI、バイパス設定、バイパスする URI の一覧、および資格情報を使用して、WebProxy クラスの新しいインスタンスを初期化します。

WebProxy(Uri, Boolean, String[])

指定した WebProxy インスタンス、バイパス設定、およびバイパスする URI の一覧を使用して、Uri クラスの新しいインスタンスを初期化します。

WebProxy(String, Boolean, String[])

指定した URI、バイパス設定、およびバイパスする URI の一覧を使用して、WebProxy クラスの新しいインスタンスを初期化します。

WebProxy(Uri, Boolean)

WebProxy インスタンスとバイパス設定を使用して、Uri クラスの新しいインスタンスを初期化します。

WebProxy(Uri, Boolean, String[], ICredentials)

指定した WebProxy インスタンス、バイパス設定、バイパスする URI の一覧、および資格情報を使用して、Uri クラスの新しいインスタンスを初期化します。

WebProxy(String, Boolean)

指定した URI とバイパス設定を使用して、WebProxy クラスの新しいインスタンスを初期化します。

WebProxy(SerializationInfo, StreamingContext)
古い.

既にシリアル化されたコンテンツを使用して、WebProxy クラスのインスタンスを初期化します。

WebProxy(Uri)

指定された WebProxy インスタンスから Uri クラスの新しいインスタンスを初期化します。

WebProxy(String)

指定した URI を使用して、WebProxy クラスの新しいインスタンスを初期化します。

WebProxy(String, Int32)

指定したホストとポート番号を使用して、WebProxy クラスの新しいインスタンスを初期化します。

WebProxy()

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

WebProxy クラスの空のインスタンスを初期化します。

public:
 WebProxy();
public WebProxy ();
Public Sub New ()

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxy()
{
   return gcnew WebProxy;
}
public static WebProxy CreateProxy()
{
    return new WebProxy();
}

注釈

パラメーターなしのコンストラクターは、 プロパティを に設定してWebProxy、 クラスの空のインスタンスをnullAddress初期化します。

プロパティが のAddress場合、 メソッドは nullIsBypassedtrue返し、メソッドはGetProxy宛先アドレスを返します。

適用対象

WebProxy(String, Boolean, String[], ICredentials)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定した URI、バイパス設定、バイパスする URI の一覧、および資格情報を使用して、WebProxy クラスの新しいインスタンスを初期化します。

public:
 WebProxy(System::String ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList, System::Net::ICredentials ^ Credentials);
public WebProxy (string? Address, bool BypassOnLocal, string[]? BypassList, System.Net.ICredentials? Credentials);
public WebProxy (string Address, bool BypassOnLocal, string[] BypassList, System.Net.ICredentials Credentials);
new System.Net.WebProxy : string * bool * string[] * System.Net.ICredentials -> System.Net.WebProxy
Public Sub New (Address As String, BypassOnLocal As Boolean, BypassList As String(), Credentials As ICredentials)

パラメーター

Address
String

プロキシ サーバーの URI。

BypassOnLocal
Boolean

ローカル アドレスのプロキシをバイパスする場合は true。それ以外の場合は false

BypassList
String[]

バイパスするサーバーの URI を含む正規表現文字列の配列。

Credentials
ICredentials

認証用にプロキシ サーバーに送信する ICredentials インスタンス。

例外

Address が無効な URI です。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithCredentials( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( "http://contoso",
      bypassLocal,
      bypassList,
      CredentialCache::DefaultCredentials );
}
public static WebProxy CreateProxyWithCredentials(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy("http://contoso",
        bypassLocal,
        bypassList,
        CredentialCache.DefaultCredentials);
}

注釈

インスタンスはWebProxy、 プロパティが Address を含むAddressインスタンスに設定され、 プロパティが にUri設定されBypassProxyOnLocal、 プロパティが BypassListBypassListBypassOnLocal設定され、 プロパティが にCredentials設定されてCredentials初期化されます。

こちらもご覧ください

適用対象

WebProxy(Uri, Boolean, String[])

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定した WebProxy インスタンス、バイパス設定、およびバイパスする URI の一覧を使用して、Uri クラスの新しいインスタンスを初期化します。

public:
 WebProxy(Uri ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList);
public WebProxy (Uri? Address, bool BypassOnLocal, string[]? BypassList);
public WebProxy (Uri Address, bool BypassOnLocal, string[] BypassList);
new System.Net.WebProxy : Uri * bool * string[] -> System.Net.WebProxy
Public Sub New (Address As Uri, BypassOnLocal As Boolean, BypassList As String())

パラメーター

Address
Uri

プロキシ サーバーのアドレスを格納している Uri インスタンス。

BypassOnLocal
Boolean

ローカル アドレスのプロキシをバイパスする場合は true。それ以外の場合は false

BypassList
String[]

バイパスするサーバーの URI を含む正規表現文字列の配列。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithBypassList( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( gcnew Uri( "http://contoso" ),
      bypassLocal,
      bypassList );
}
public static WebProxy CreateProxyWithBypassList(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy(new Uri("http://contoso"),
        bypassLocal,
        bypassList);
}

注釈

インスタンスはWebProxy、 プロパティが に設定され、 Address プロパティが BypassProxyOnLocalAddressBypassOnLocal設定され、 プロパティが BypassList に設定されてBypassList初期化されます。

適用対象

WebProxy(String, Boolean, String[])

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定した URI、バイパス設定、およびバイパスする URI の一覧を使用して、WebProxy クラスの新しいインスタンスを初期化します。

public:
 WebProxy(System::String ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList);
public WebProxy (string? Address, bool BypassOnLocal, string[]? BypassList);
public WebProxy (string Address, bool BypassOnLocal, string[] BypassList);
new System.Net.WebProxy : string * bool * string[] -> System.Net.WebProxy
Public Sub New (Address As String, BypassOnLocal As Boolean, BypassList As String())

パラメーター

Address
String

プロキシ サーバーの URI。

BypassOnLocal
Boolean

ローカル アドレスのプロキシをバイパスする場合は true。それ以外の場合は false

BypassList
String[]

バイパスするサーバーの URI を含む正規表現文字列の配列。

例外

Address が無効な URI です。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithHostAndBypassList( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( "http://contoso",
      bypassLocal,
      bypassList );
}
public static WebProxy CreateProxyWithHostAndBypassList(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy("http://contoso",
        bypassLocal,
        bypassList);
}

注釈

インスタンスはWebProxy、 プロパティが Address を含むAddressインスタンスに設定され、 Uri プロパティが BypassProxyOnLocalBypassOnLocal設定され、 プロパティが BypassList に設定されてBypassList初期化されます。

こちらもご覧ください

適用対象

WebProxy(Uri, Boolean)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

WebProxy インスタンスとバイパス設定を使用して、Uri クラスの新しいインスタンスを初期化します。

public:
 WebProxy(Uri ^ Address, bool BypassOnLocal);
public WebProxy (Uri? Address, bool BypassOnLocal);
public WebProxy (Uri Address, bool BypassOnLocal);
new System.Net.WebProxy : Uri * bool -> System.Net.WebProxy
Public Sub New (Address As Uri, BypassOnLocal As Boolean)

パラメーター

Address
Uri

プロキシ サーバーのアドレスを格納している Uri インスタンス。

BypassOnLocal
Boolean

ローカル アドレスのプロキシをバイパスする場合は true。それ以外の場合は false

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithExampleAddress( bool bypassLocal )
{
   return gcnew WebProxy( gcnew Uri( "http://contoso" ), bypassLocal );
}
public static WebProxy CreateProxyWithExampleAddress(bool bypassLocal)
{
    return new WebProxy(new Uri("http://contoso"), bypassLocal);
}

注釈

インスタンスはWebProxy、 プロパティが に設定されAddress、 プロパティが にAddress設定されたBypassProxyOnLocalBypassOnLocal状態で初期化されます。

適用対象

WebProxy(Uri, Boolean, String[], ICredentials)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定した WebProxy インスタンス、バイパス設定、バイパスする URI の一覧、および資格情報を使用して、Uri クラスの新しいインスタンスを初期化します。

public:
 WebProxy(Uri ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList, System::Net::ICredentials ^ Credentials);
public WebProxy (Uri? Address, bool BypassOnLocal, string[]? BypassList, System.Net.ICredentials? Credentials);
public WebProxy (Uri Address, bool BypassOnLocal, string[] BypassList, System.Net.ICredentials Credentials);
new System.Net.WebProxy : Uri * bool * string[] * System.Net.ICredentials -> System.Net.WebProxy
Public Sub New (Address As Uri, BypassOnLocal As Boolean, BypassList As String(), Credentials As ICredentials)

パラメーター

Address
Uri

プロキシ サーバーのアドレスを格納している Uri インスタンス。

BypassOnLocal
Boolean

ローカル アドレスのプロキシをバイパスする場合は true。それ以外の場合は false

BypassList
String[]

バイパスするサーバーの URI を含む正規表現文字列の配列。

Credentials
ICredentials

認証用にプロキシ サーバーに送信する ICredentials インスタンス。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithCredentials2( bool bypassLocal )
{
   
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( gcnew Uri( "http://contoso" ),
      bypassLocal,
      bypassList,
      CredentialCache::DefaultCredentials );
}
public static WebProxy CreateProxyWithCredentials2(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy(new Uri("http://contoso"),
        bypassLocal,
        bypassList,
        CredentialCache.DefaultCredentials);
}

注釈

インスタンスはWebProxy、 プロパティが に設定され、 Address プロパティが にAddress設定され、 BypassProxyOnLocal プロパティが BypassListBypassOnLocalBypassList設定され、 プロパティが Credentials に設定されてCredentials初期化されます。

適用対象

WebProxy(String, Boolean)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定した URI とバイパス設定を使用して、WebProxy クラスの新しいインスタンスを初期化します。

public:
 WebProxy(System::String ^ Address, bool BypassOnLocal);
public WebProxy (string? Address, bool BypassOnLocal);
public WebProxy (string Address, bool BypassOnLocal);
new System.Net.WebProxy : string * bool -> System.Net.WebProxy
Public Sub New (Address As String, BypassOnLocal As Boolean)

パラメーター

Address
String

プロキシ サーバーの URI。

BypassOnLocal
Boolean

ローカル アドレスのプロキシをバイパスする場合は true。それ以外の場合は false

例外

Address が無効な URI です。

次のコード例では、このコンストラクターの呼び出しを示します。

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(bool bypassLocal)
{
    WebProxy proxy =  new WebProxy("http://contoso", bypassLocal);
    Console.WriteLine("Bypass proxy for local URIs?: {0}",
       proxy.BypassProxyOnLocal);
    return proxy;
}

注釈

インスタンスはWebProxy、 プロパティが Address を含むAddressインスタンスにUri設定され、 プロパティが BypassProxyOnLocal に設定されたBypassOnLocal状態で初期化されます。

こちらもご覧ください

適用対象

WebProxy(SerializationInfo, StreamingContext)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

注意事項

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

既にシリアル化されたコンテンツを使用して、WebProxy クラスのインスタンスを初期化します。

protected:
 WebProxy(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext streamingContext);
protected WebProxy (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected WebProxy (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
new System.Net.WebProxy : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebProxy
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Net.WebProxy : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebProxy
Protected Sub New (serializationInfo As SerializationInfo, streamingContext As StreamingContext)

パラメーター

serializationInfo
SerializationInfo

シリアル化データ。

streamingContext
StreamingContext

シリアル化されたデータのコンテキスト。

属性

注釈

このメソッドは、インスタンスを逆シリアル化 WebProxy するためにシステムによって呼び出されます。アプリケーションでは呼び出されません。

適用対象

WebProxy(Uri)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定された WebProxy インスタンスから Uri クラスの新しいインスタンスを初期化します。

public:
 WebProxy(Uri ^ Address);
public WebProxy (Uri? Address);
public WebProxy (Uri Address);
new System.Net.WebProxy : Uri -> System.Net.WebProxy
Public Sub New (Address As Uri)

パラメーター

Address
Uri

プロキシ サーバーのアドレスを格納している Uri インスタンス。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithExampleAddress()
{
   return gcnew WebProxy( gcnew Uri( "http://contoso" ) );
}
public static WebProxy CreateProxyWithExampleAddress()
{
    return new WebProxy(new Uri("http://contoso"));
}

注釈

インスタンスはWebProxy、 パラメーターに設定Addressされた Address プロパティで初期化されます。

適用対象

WebProxy(String)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定した URI を使用して、WebProxy クラスの新しいインスタンスを初期化します。

public:
 WebProxy(System::String ^ Address);
public WebProxy (string? Address);
public WebProxy (string Address);
new System.Net.WebProxy : string -> System.Net.WebProxy
Public Sub New (Address As String)

パラメーター

Address
String

プロキシ サーバーの URI。

例外

Address が無効な URI です。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithHost()
{
   return gcnew WebProxy( "http://contoso" );
}
public static WebProxy CreateProxyWithHost()
{
    return new WebProxy("http://contoso");
}

注釈

インスタンスはWebProxy、 プロパティが をAddress含むAddressインスタンスに設定された状態でUri初期化されます。

適用対象

WebProxy(String, Int32)

ソース:
WebProxy.cs
ソース:
WebProxy.cs
ソース:
WebProxy.cs

指定したホストとポート番号を使用して、WebProxy クラスの新しいインスタンスを初期化します。

public:
 WebProxy(System::String ^ Host, int Port);
public WebProxy (string Host, int Port);
new System.Net.WebProxy : string * int -> System.Net.WebProxy
Public Sub New (Host As String, Port As Integer)

パラメーター

Host
String

プロキシ ホストの名前。

Port
Int32

使用する Host のポート番号。

例外

HostPort の組み合わせによって形成される URI が有効な URI ではありません。

次のコード例では、このコンストラクターの呼び出しを示します。

WebProxy^ CreateProxyWithHostAndPort()
{
   return gcnew WebProxy( "contoso",80 );
}
public static WebProxy CreateProxyWithHostAndPort()
{
    return new WebProxy("contoso", 80);
}

注釈

インスタンスはWebProxy、 プロパティを Address http:// フォーム Host のインスタンスに設定してUri初期化されますPort

適用対象