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 服務用戶端通訊協定 number
,其中的 number
是 Common Language Runtime 的版本 (例如 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 服務器識別用戶端。