WebProxy.Address 属性

定义

获取或设置代理服务器的地址。Gets or sets the address of the proxy server.

public:
 property Uri ^ Address { Uri ^ get(); void set(Uri ^ value); };
public Uri? Address { get; set; }
public Uri Address { get; set; }
member this.Address : Uri with get, set
Public Property Address As Uri

属性值

Uri

一个 Uri 实例,它包含代理服务器的地址。A Uri instance that contains the address of the proxy server.

示例

下面的代码示例显示对象的属性 WebProxy ,包括其 AddressThe following code example displays the properties of a WebProxy object, including its Address.

// The following method displays the properties of the 
// specified WebProxy instance.
void DisplayProxyProperties( WebProxy^ proxy )
{
   Console::WriteLine( "Address: {0}", proxy->Address );
   Console::WriteLine( "Bypass on local: {0}", proxy->BypassProxyOnLocal );

   int count = proxy->BypassList->Length;
   if ( count == 0 )
   {
      Console::WriteLine( "The bypass list is empty." );
      return;
   }

   array<String^>^bypass = proxy->BypassList;
   Console::WriteLine( "The bypass list contents:" );
   for ( int i = 0; i < count; i++ )
   {
      Console::WriteLine( bypass[ i ] );

   }
}
// The following method displays the properties of the
// specified WebProxy instance.

public static void DisplayProxyProperties(WebProxy proxy)
{
    Console.WriteLine("Address: {0}", proxy.Address);
    Console.WriteLine( "Bypass on local: {0}", proxy.BypassProxyOnLocal );

    int count = proxy.BypassList.Length;
    if (count == 0)
    {
        Console.WriteLine("The bypass list is empty.");
        return;
    }
    string[] bypass = proxy.BypassList;
    Console.WriteLine("The bypass list contents:");

    for (int i=0; i< count; i++)
    {
        Console.WriteLine(bypass[i]);
    }
}

注解

Address属性包含代理服务器的地址。The Address property contains the address of the proxy server. 当未启用自动代理检测且未指定自动配置脚本时, Address 属性和 BypassList 确定用于请求的代理。When automatic proxy detection is not enabled, and no automatic configuration script is specified, the Address property and BypassList determine the proxy used for a request.

Address 属性为时 null ,请求将绕过代理并直接连接到目标主机。When the Address property is null, requests bypass the proxy and connect directly to the destination host.

适用于