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

屬性值

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

適用於