แก้ไข

แชร์ผ่าน


ClientTarget.UserAgent Property

Definition

Gets the user agent's identification name.

public:
 property System::String ^ UserAgent { System::String ^ get(); };
[System.Configuration.ConfigurationProperty("userAgent", IsRequired=true)]
[System.Configuration.StringValidator(MinLength=1)]
public string UserAgent { get; }
[<System.Configuration.ConfigurationProperty("userAgent", IsRequired=true)>]
[<System.Configuration.StringValidator(MinLength=1)>]
member this.UserAgent : string
Public ReadOnly Property UserAgent As String

Property Value

The user agent's identification name.

Attributes

Examples

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);
' Get the first client target 
' in the collection.
clientTarget = clientTargets(0)

' Get he user agent.
userAgent = clientTarget.UserAgent

msg = String.Format( _
"User Agent: {0}" + ControlChars.Lf, userAgent)

Remarks

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.

Applies to

See also