HttpResponse.ContentType 속성

정의

출력 스트림의 HTTP 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

출력 스트림의 HTTP MIME 형식입니다. 기본값은 "text/html"입니다.

예외

ContentType 속성은 null로 설정됩니다.

예제

다음 예제에서는 이미지/jpeg에 대 한 응답에 대 한 속성을 설정 ContentType 하 고 응답에 연결 될 수 있는 다른 콘텐츠를 제거 하는 메서드를 호출 Clear 하 고 모든 콘텐츠를 요청 하는 클라이언트에 전송 되기 전에 전체 페이지를 처리 되도록 true로 속성을 설정 BufferOutput 합니다.

전체 예제는 클래스를 참조하세요 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

적용 대상