ClientTarget.UserAgent 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取用户代理的标识名称。
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 配置默认值允许为各种Microsoft Internet Explorer 版本自定义页面。 在其中可以找到别名,该别名 uplevel指示 ASP.NET 发送 Internet Explorer 4.0 及更高版本支持的客户端 HTML 和 ECMAScript,并 downlevel告知 ASP.NET 将早期浏览器支持的 HTML 和脚本限制为 Internet Explorer 4.0 支持。