Compartir a través de


HttpWebRequest.UserAgent Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Property UserAgent As String
public string UserAgent { get; set; }

Property Value

Type: System.String
The value of the User-agent HTTP header. The default value is nulla null reference (Nothing in Visual Basic).

NoteNote:

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

Remarks

Version Notes

Silverlight for the desktop

Do not use this member when targeting Silverlight 4.

Silverlight for Windows Phone Silverlight for Windows Phone

You can use this member when targeting Silverlight for Windows Phone to specify the User-agent string. For more information see Header Support.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.