次の方法で共有


HttpWebClientProtocol.Proxy プロパティ

ファイアウォールをとおして XML Web サービス要求を行うためのプロキシ情報を取得または設定します。

Public Property Proxy As IWebProxy
[C#]
public IWebProxy Proxy {get; set;}
[C++]
public: __property IWebProxy* get_Proxy();public: __property void set_Proxy(IWebProxy*);
[JScript]
public function get Proxy() : IWebProxy;public function set Proxy(IWebProxy);

プロパティ値

ファイアウォールをとおして要求を行うためのプロキシ情報を格納している IWebProxy 。既定値は、オペレーティング システムのプロキシ設定値です。

解説

クライアントでシステムの設定と異なるプロキシ設定値を使用する必要がある場合は、 Proxy プロパティを使用します。 WebProxy クラスは IWebProxy を実装しているため、このクラスを使用してプロキシ設定を行うことができます。

既定のプロキシ設定は、構成ファイルで設定できます。詳細については、「 インターネット アプリケーションの構成 」を参照してください。

使用例

[Visual Basic, C#, C++] Math XML Web サービスを呼び出す前にプロキシ設定を行う例を次に示します。この例の設定では、プロキシ サーバーが http://proxyserver、プロキシ ポートが 80、ローカル アドレスについてはプロキシ サーバーをバイパスします。

 
Dim math As New MyMath.Math()

' Set the proxy server to proxyserver, set the port to 80, and specify
' to bypass the proxy server for local addresses.
Dim proxyObject As New WebProxy("http://proxyserver:80", True)
math.Proxy = proxyObject

' Call the Add XML Web service method.
Dim total As Integer = math.Add(8, 5)
    . . . 
Dim math As New MyMath.Math()

' Set the proxy server to proxyserver, set the port to 80, and specify
' to bypass the proxy server for local addresses.
Dim proxyObject As New WebProxy("http://proxyserver:80", True)
math.Proxy = proxyObject

' Call the Add XML Web service method.
Dim total As Integer = math.Add(8, 5)

[C#] 
MyMath.Math math = new MyMath.Math();

// Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server
// for local addresses.
IWebProxy proxyObject = new WebProxy("http://proxyserver:80", true);
math.Proxy = proxyObject;

// Call the Add XML Web service method.
int total = math.Add(8, 5);

[C++] 
MyMath::Math* math = new MyMath::Math();

// Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server
// for local addresses.
IWebProxy* proxyObject = new WebProxy(S"http://proxyserver:80", true);
math->Proxy = proxyObject;

// Call the Add XML Web service method.
int total = math->Add(8, 5);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

HttpWebClientProtocol クラス | HttpWebClientProtocol メンバ | System.Web.Services.Protocols 名前空間 | IWebProxy | WebProxy