Export (0) Print
Expand All

ClientTarget.UserAgent Property

Gets the user agent's identification name.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)

public string UserAgent { get; }
/** @property */
public String get_UserAgent ()

public function get UserAgent () : String

Not applicable.

Property Value

The user agent's identification name.

The UserAgent property refers to the userAgent attribute of the add element in the clientTarget section of the configuration file.

The ASP.NET configuration defaults allow customizing pages for various Microsoft Internet Explorer versions. Among them you find the alias uplevel, which tells ASP.NET to send the client HTML and ECMAScript supported by Internet Explorer 4.0 and later, and downlevel, which tells ASP.NET to limit the HTML and script to that supported by earlier browsers than Internet Explorer 4.0.

The following code example shows how to get the UserAgent from the configuration file of an existing Web application.

 
// Get the first client target 
// in the collection.
clientTarget = clientTargets[0];

// Get he user agent.
userAgent = clientTarget.UserAgent;

msg = String.Format(
      "User Agent: {0}\n",
      userAgent);


Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft