Gets or sets the proxy used to communicate with the FTP server.
Public Overrides Property Proxy As IWebProxy
public override IWebProxy Proxy { get; set; }
public: virtual property IWebProxy^ Proxy { IWebProxy^ get () override; void set (IWebProxy^ value) override; }
abstract Proxy : IWebProxy with get, set override Proxy : IWebProxy with get, set
This property cannot be set to nullNothingnullptra null reference (Nothing in Visual Basic).
A new value was specified for this property for a request that is already in progress.
The Proxy property identifies the IWebProxy instance that communicates with the FTP server. The proxy is set by the system by using configuration files and the Internet Explorer Local Area Network settings. To specify that no proxy should be used, set Proxy to the proxy instance returned by the GlobalProxySelection..::.GetEmptyWebProxy method. For more information about automatic proxy detection, see Automatic Proxy Detection.
You must set Proxy before writing data to the request's stream or getting the response. Changing Proxy after calling the GetRequestStream, BeginGetRequestStream, GetResponse, or BeginGetResponse method causes an InvalidOperationException exception.
The FtpWebRequest class supports HTTP and ISA Firewall Client proxies.
If the specified proxy is an HTTP proxy, only the DownloadFile, ListDirectory, and ListDirectoryDetails commands are supported.
The following code example displays this property value.
Dim proxy As IWebProxy = request.Proxy If proxy IsNot Nothing Then Console.WriteLine("Proxy: {0}", proxy.GetProxy(request.RequestUri)) Else Console.WriteLine("Proxy: (none)") End If Console.WriteLine("ConnectionGroup: {0}", If(request.ConnectionGroupName Is Nothing, "none", request.ConnectionGroupName))
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 );
IWebProxy^ proxy = request->Proxy; if ( proxy ) { Console::WriteLine( "Proxy: {0}", proxy->GetProxy( request->RequestUri ) ); } else { Console::WriteLine( "Proxy: (none)" ); } Console::WriteLine( "ConnectionGroup: {0}", request->ConnectionGroupName == nullptr ? "none" : request->ConnectionGroupName );
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2