HttpRequest.UserAgent 屬性

定義

取得已提供的客戶端瀏覽器原始用戶代理字串。 請注意,這可能是無效的。

public:
 property System::String ^ UserAgent { System::String ^ get(); };
public string UserAgent { get; }
member this.UserAgent : string
Public ReadOnly Property UserAgent As String

屬性值

用戶端瀏覽器的原始使用者代理字串。

範例

以下程式碼範例將請求瀏覽器的型別識別指派給一個字串變數。

String userAgent;
userAgent = Request.UserAgent;
if (userAgent.IndexOf("MSIE 6.0") > -1)
{
   // The browser is Microsoft Internet Explorer Version 6.0.
}

Dim userAgent As String
 userAgent= Request.UserAgent
 If userAgent.IndexOf("MSIE 6.0") > -1 Then
    ' The browser is Microsoft Internet Explorer 6.0.
 End If
   

適用於

另請參閱