HttpRequest.UserAgent Właściwość

Definicja

Pobiera nieprzetworzone ciągi agenta użytkownika w podanej przeglądarce klienta. Pamiętaj, że może to być wartość null.

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

Wartość właściwości

String

Nieprzetworzona ciąg agenta użytkownika w przeglądarce klienta.

Przykłady

Poniższy przykład kodu przypisuje identyfikację typu przeglądarki żądającej do zmiennej ciągu.

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
   

Dotyczy

Zobacz też