Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

FtpWebRequest.Proxy Property

Gets or sets the proxy used to communicate with the FTP server.

Namespace: System.Net
Assembly: System (in system.dll)

public override IWebProxy Proxy { get; set; }
/** @property */
public IWebProxy get_Proxy ()

/** @property */
public void set_Proxy (IWebProxy value)

public override function get Proxy () : IWebProxy

public override function set Proxy (value : IWebProxy)

Not applicable.

Property Value

An IWebProxy instance responsible for communicating with the FTP server.
Exception typeCondition

ArgumentNullException

This property cannot be set to a null reference (Nothing in Visual Basic).

InvalidOperationException

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.

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

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.