HttpWebClientProtocol.UserAgent 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置随每个请求发送的用户代理标头的值。
public:
property System::String ^ UserAgent { System::String ^ get(); void set(System::String ^ value); };
public string UserAgent { get; set; }
[System.ComponentModel.Browsable(false)]
public string UserAgent { get; set; }
member this.UserAgent : string with get, set
[<System.ComponentModel.Browsable(false)>]
member this.UserAgent : string with get, set
Public Property UserAgent As String
属性值
HTTP 协议用户代理标头的值。 默认为“MS Web Services Client Protocol number
”,其中 number
为公共语言运行时的版本(例如 1.0.3705.0)。
- 属性
示例
// MyMath is a proxy class.
test::MyMath^ objMyMath = gcnew test::MyMath;
// Get the default user agent.
Console::WriteLine( "Default user agent is: {0}", objMyMath->UserAgent );
objMyMath->UserAgent = "My Agent";
Console::WriteLine( "Modified user agent is: {0}", objMyMath->UserAgent );
// MyMath is a proxy class.
MyMath objMyMath = new MyMath();
// Get the default user agent.
Console.WriteLine("Default user agent is: " + objMyMath.UserAgent);
objMyMath.UserAgent = "My Agent";
Console.WriteLine("Modified user agent is: " + objMyMath.UserAgent);
' MyMath is a proxy class.
Dim objMyMath As MyMath = new MyMath()
' Get the default user agent.
Console.WriteLine("Default user agent is: " & objMyMath.UserAgent)
objMyMath.UserAgent = "My Agent"
Console.WriteLine("Modified user agent is: " & objMyMath.UserAgent)
注解
用户代理字符串允许 Web 服务器标识客户端。