HttpRequest.HttpMethod 屬性

定義

取得用戶端使用的 HTTP 資料傳輸方法 (例如 GETPOSTHEAD)。

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

屬性值

String

用戶端使用的 HTTP 資料傳輸方法。

範例

下列程式碼範例會 HtmlEncode 使用 方法來 HTML 編碼 屬性的值 HttpMethod ,以及 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))

下列範例顯示此程式碼所產生的輸出。

GET

127.0.0.1

127.0.0.1

GET

適用於