Share via


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 是指 userAgentadd 組態檔區段中元素 clientTarget 的屬性。

ASP.NET 組態預設值允許自訂各種Microsoft Internet Explorer 版本的頁面。 在這些別名中,您會找到別名 uplevel ,告知 ASP.NET 傳送 Internet Explorer 4.0 和更新版本所支援的用戶端 HTML 和 ECMAScript,並 downlevel 告知 ASP.NET 將 HTML 和腳本限制為比 Internet Explorer 4.0 更早的瀏覽器所支援的 HTML 和腳本。

適用於

另請參閱