HttpRequest.UserAgent HttpRequest.UserAgent HttpRequest.UserAgent HttpRequest.UserAgent Property

定義

取得已提供的用戶端瀏覽器原始使用者代理程式字串。Gets the raw user agent string of the client browser that has been provided. 請注意,它可以是 null。Please note it may be null.

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

屬性值

用戶端瀏覽器的原始使用者代理字串。The raw user agent string of the client browser.

範例

下列程式碼範例會將要求的瀏覽器的型別識別指派給字串變數。The following code example assigns the type identification of the requesting browser to a string variable.

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
   

適用於

另請參閱