UserAgent Property

HttpWebRequest.UserAgent Property


Gets or sets the value of the User-agent HTTP header.

Namespace:   System.Net
Assembly:  System (in System.dll)

member UserAgent : string with get, set

Property Value

Type: System.String

The value of the User-agent HTTP header. The default value is null.


The value for this property is stored in WebHeaderCollection. If WebHeaderCollection is set, the property value is lost.

The following code example sets the UserAgent property.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Available since 5.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2016 Microsoft