HttpWebClientProtocol.UserAgent Property

Definition

Gets or sets the value for the user agent header that is sent with each request.

C#
public string UserAgent { get; set; }
C#
[System.ComponentModel.Browsable(false)]
public string UserAgent { get; set; }

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

C#
// 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);

Remarks

The user agent string allows a Web server to identify the client.

Applies to

Производ Верзије
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also