HttpResponse.ContentType Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur jenis HTTP MIME dari aliran output.
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
Nilai Properti
Jenis HTTP MIME dari aliran output. Nilai defaultnya adalah "text/html".
Pengecualian
Properti ContentType disetel ke null.
Contoh
Contoh berikut mengatur ContentType properti untuk respons terhadap gambar/jpeg, memanggil Clear metode untuk menghapus konten lain yang mungkin dilampirkan ke respons, lalu mengatur properti ke true sehingga halaman lengkap akan diproses BufferOutput sebelum konten dikirim ke klien yang meminta.
Untuk contoh lengkapnya, lihat HttpResponse kelas .
// Set the page's content type to JPEG files
// and clears all content output from the buffer stream.
Response.ContentType = "image/jpeg";
Response.Clear();
// Buffer response so that page is sent
// after processing is complete.
Response.BufferOutput = true;
' Set the page's content type to JPEG files
' and clears all content output from the buffer stream.
Response.ContentType = "image/jpeg"
Response.Clear()
' Buffer response so that page is sent
' after processing is complete.
Response.BufferOutput = True