WebProxy.Address 属性

定义

获取或设置代理服务器的地址。

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 实例,它包含代理服务器的地址。

示例

下面的代码示例显示 对象的属性 WebProxy ,包括其 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 包含代理服务器的地址。 如果未启用自动代理检测,并且未指定自动配置脚本,则 Address 属性和 BypassList 确定用于请求的代理。

Address当 属性为 null时,请求绕过代理并直接连接到目标主机。

适用于