Freigeben über


HttpRequest.UserHostAddress-Eigenschaft

Ruft die IP-Hostadresse des Remoteclients ab.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

Syntax

'Declaration
Public ReadOnly Property UserHostAddress As String
'Usage
Dim instance As HttpRequest
Dim value As String

value = instance.UserHostAddress
public string UserHostAddress { get; }
public:
property String^ UserHostAddress {
    String^ get ();
}
/** @property */
public String get_UserHostAddress ()
public function get UserHostAddress () : String

Eigenschaftenwert

Die IP-Adresse des Remoteclients.

Beispiel

Im folgenden Codebeispiel wird die HtmlEncode-Methode für das Codieren des Werts der UserHostAddress-Eigenschaft im HTML-Format verwendet und die WriteLine-Methode für das Schreiben des codierten Werts in die Datei. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die HttpRequest-Klasse.

' Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.RequestType))
sw.WriteLine(Server.HtmlEncode(Request.UserHostAddress))
sw.WriteLine(Server.HtmlEncode(Request.UserHostName))
sw.WriteLine(Server.HtmlEncode(Request.HttpMethod))
// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.RequestType));
sw.WriteLine(Server.HtmlEncode(Request.UserHostAddress));
sw.WriteLine(Server.HtmlEncode(Request.UserHostName));
sw.WriteLine(Server.HtmlEncode(Request.HttpMethod));

Plattformen

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

HttpRequest-Klasse
HttpRequest-Member
System.Web-Namespace