HttpWebClientProtocol.UserAgent Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Property Value
The value of the HTTP protocol user agent header. 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).
- Attributes
Examples
// 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)
Remarks
The user agent string allows a Web server to identify the client.
Applies to
See also
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.