HttpWebClientProtocol.UserAgent 属性
定义
获取或设置随每个请求发送的用户代理标头的值。Gets or sets the value for the user agent header that is sent with each request.
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 协议用户代理标头的值。The value of the HTTP protocol user agent header. 默认为“MS Web Services Client Protocol number”,其中 number 为公共语言运行时的版本(例如 1.0.3705.0)。The default is "MS Web Services Client Protocol number ", where number is the version of the common language runtime (for example, 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 服务器标识客户端。The user agent string allows a Web server to identify the client.