FtpWebRequest.Proxy Property

Definition

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

C#
public override System.Net.IWebProxy? Proxy { get; set; }
C#
public override System.Net.IWebProxy Proxy { get; set; }

Property Value

An IWebProxy instance responsible for communicating with the FTP server. On .NET Core, its value is null.

Exceptions

This property cannot be set to null.

A new value was specified for this property for a request that is already in progress.

Examples

The following code example displays this property value.

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

Remarks

Note

This property is not supported on .NET Core, and setting it has no effect. Getting the property value returns null.

For more information about this API, see Supplemental API remarks for System.Net.FtpWebRequest.Proxy.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also