HttpRequest.UserHostAddress 屬性

定義

取得遠端用戶端的 IP 主機位址。

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

屬性值

遠端用戶端的 IP 位址。

範例

下列程式碼範例會 HtmlEncode 使用 方法來 HTML 編碼 屬性的值 UserHostAddress ,以及 WriteLine 將編碼值寫入檔案的方法。 此程式碼範例是提供給 類別之較大範例的 HttpRequest 一部分。

// 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))

適用於