FtpWebRequest.Proxy Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the proxy used to communicate with the FTP server.
public:
virtual property System::Net::IWebProxy ^ Proxy { System::Net::IWebProxy ^ get(); void set(System::Net::IWebProxy ^ value); };
public override System.Net.IWebProxy? Proxy { get; set; }
public override System.Net.IWebProxy Proxy { get; set; }
member this.Proxy : System.Net.IWebProxy with get, set
Public Overrides Property Proxy As IWebProxy
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.
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 );
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.