HttpRequest.UserHostName 屬性

定義

取得遠端用戶端的 DNS 名稱。Gets the DNS name of the remote client.

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

屬性值

String

遠端用戶端的 DNS 名稱。The DNS name of the remote client.

範例

下列程式碼範例會使用 HtmlEncode 方法,以 HTML 編碼屬性的值 UserHostNameWriteLine 方法,以將編碼的值寫入檔案。The following code example uses the HtmlEncode method to HTML-encode the value of the UserHostName property and the WriteLine method to write the encoded value to the file. 這個程式碼範例是針對類別提供之較大範例的一部分 HttpRequestThis code example is part of a larger example provided for the HttpRequest class.

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

適用於