HttpRequest.ContentType 屬性

定義

接收或設定來函請求的 MIME 內容類型。

public:
 property System::String ^ ContentType { System::String ^ get(); void set(System::String ^ value); };
public string ContentType { get; set; }
member this.ContentType : string with get, set
Public Property ContentType As String

屬性值

一個字串代表輸入請求的 MIME 內容類型,例如「text/html」。 其他常見的 MIME 類型還包括「audio.wav」、「image/gif」和「application/pdf」。

範例

以下程式碼範例將代表來入請求內容類型的值指派給一個字串變數。

String str;
 str = Request.ContentType;

Dim str As String
 str = Request.ContentType
   

以下範例展示了此程式碼可能產生的輸出。

GET

127.0.0.1

127.0.0.1

GET

適用於