ClientTarget.UserAgent 属性

定义

获取用户代理的标识名称。

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

属性值

用户代理的标识名称。

属性

示例

下面的代码示例演示如何从现有 Web 应用程序的配置文件获取 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}\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)

注解

属性UserAgent引用userAgent配置文件 的 节中 clientTarget 元素的 属性add

ASP.NET 配置默认值允许为各种 Internet Explorer 版本Microsoft自定义页面。 其中,你可以找到别名 uplevel,它告知 ASP.NET 发送 Internet Explorer 4.0 及更高版本支持的客户端 HTML 和 ECMAScript,以及 downlevel,它告知 ASP.NET 将 HTML 和脚本限制为 Internet Explorer 4.0 之前浏览器支持的 HTML 和脚本。

适用于

另请参阅