This documentation is archived and is not being maintained.
HttpRequest.UserAgent Property
.NET Framework 1.1
Gets the raw user agent string of the client browser.
[Visual Basic] Public ReadOnly Property UserAgent As String [C#] public string UserAgent {get;} [C++] public: __property String* get_UserAgent(); [JScript] public function get UserAgent() : String;
Property Value
The raw user agent string of the client browser.
Example
The following example assigns the type identification of the requesting browser to a string variable.
[Visual Basic] Dim userAgent As String userAgent= Request.UserAgent If userAgent.IndexOf("MSIE 6.0") > -1 Then ' The browser is Microsoft Internet Explorer 6.0. End If [C#] String userAgent; userAgent = Request.UserAgent; if (userAgent.IndexOf("MSIE 6.0") > -1) { // The browser is Microsoft Internet Explorer Version 6.0. } [C++] String* userAgent; userAgent = Request->UserAgent; if (userAgent->IndexOf(S"MSIE 6.0") > -1) { // The browser is Microsoft Internet Explorer Version 6.0. } [JScript] var userAgent : String = Request.UserAgent if(userAgent.IndexOf("MSIE 6.0") > -1) { // The browser is Microsoft Internet Explorer 6.0. }
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpRequest Class | HttpRequest Members | System.Web Namespace
Show: