FtpWebRequest.UsePassive プロパティ
アセンブリ: System (system.dll 内)

Dim instance As FtpWebRequest Dim value As Boolean value = instance.UsePassive instance.UsePassive = value
/** @property */ public boolean get_UsePassive () /** @property */ public void set_UsePassive (boolean value)
クライアント アプリケーションのデータ転送処理がデータ ポートで接続を待機する場合は false。それ以外で、クライアントがデータ ポートで接続を開始する必要がある場合は true。既定値は true です。


UsePassive プロパティを true に設定すると、サーバーに "PASV" コマンドが送信されます。このコマンドはサーバーに対して、データ ポートで待機し、転送コマンドの受信時に接続を開始するのではなく、接続を待つように要求します。
UsePassive の使用によって指定される動作の詳細については、RFC 959 『File Transfer Protocol』(http://www.rfc-editor.org/) の Section 3.2 「Establishing Data Connections」および Section 4.1.2 「Transfer Parameter Commands」を参照してください。
GetRequestStream、BeginGetRequestStream、GetResponse、または BeginGetResponse の各メソッドを呼び出した後に UsePassive を変更すると、InvalidOperationException 例外が発生します。
UsePassive が true に設定されている場合は、FTP サーバーがファイルのサイズを送信せず、ダウンロードの進行状況が常に 0 になることがあります。UsePassive が false に設定されている場合は、ファイアウォールで警告が発生し、ファイルのダウンロードがブロックされることがあります。

指定した FtpWebRequest オブジェクトのプロパティ値を、取得したり表示したりするコード例を次に示します。
// DisplayRequestProperties prints a request's properties. // This method should be called after the request is sent to the server. private static void DisplayRequestProperties(FtpWebRequest request) { Console.WriteLine("User {0} {1}", request.Credentials.GetCredential(request.RequestUri,"basic").UserName , request.RequestUri ); Console.WriteLine("Request: {0} {1}", request.Method, request.RequestUri ); Console.WriteLine("Passive: {0} Keep alive: {1} Binary: {2} Timeout: {3}.", request.UsePassive, request.KeepAlive, request.UseBinary, request.Timeout == -1 ? "none" : request.Timeout.ToString() ); IWebProxy proxy = request.Proxy; if (proxy != null) { Console.WriteLine("Proxy: {0}", proxy.GetProxy(request.RequestUri)); } else { Console.WriteLine("Proxy: (none)"); } Console.WriteLine("ConnectionGroup: {0}", request.ConnectionGroupName == null ? "none" : request.ConnectionGroupName ); Console.WriteLine("Encrypted connection: {0}", request.EnableSsl); Console.WriteLine("Method: {0}", request.Method); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からFtpWebRequest.UsePassive プロパティを検索する場合は、下記のリンクをクリックしてください。

- FtpWebRequest.UsePassive プロパティのページへのリンク