Freigeben über


HttpWebClientProtocol.UserAgent Eigenschaft

Definition

Ruft den mit jeder Anforderung gesendeten Wert für den User-Agent-Header ab oder legt diesen fest.

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

Eigenschaftswert

Der Wert des User-Agent-Headers beim HTTP-Protokoll. Der Standardwert ist "MS Web Services Client Protocol number", wobei number die Version der Common Language Runtime, z. B. 1.0.3705.0, ist.

Attribute

Beispiele

// 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)

Hinweise

Die Benutzer-Agent-Zeichenfolge ermöglicht es einem Webserver, den Client zu identifizieren.

Gilt für:

Weitere Informationen