Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
UserAgent Property

HttpRequest.UserAgent Property

Gets the raw user agent string of the client browser.

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

public string UserAgent { get; }

Property Value

Type: System.String
The raw user agent string of the client browser.

The following code example assigns the type identification of the requesting browser to a string variable.

String userAgent;
userAgent = Request.UserAgent;
if (userAgent.IndexOf("MSIE 6.0") > -1) 
{
   // The browser is Microsoft Internet Explorer Version 6.0.
}
   

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Show:
© 2015 Microsoft