HttpResponse.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.

Исключения

Свойству ContentType задано значение null.

Примеры

В следующем примере задается ContentType свойство ответа на image/jpeg, вызывается Clear метод для удаления другого содержимого, которое может быть присоединено к ответу, а затем задает BufferOutput для свойства значение true, чтобы полная страница обрабатывалась до отправки содержимого клиенту запроса.

Полный пример см. в описании HttpResponse класса.

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

Применяется к