HttpResponse.ContentType Propiedad

Definición

Obtiene o establece el tipo MIME HTTP del flujo de salida.

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

Valor de propiedad

Tipo MIME HTTP del flujo de salida. El valor predeterminado es "text/html".

Excepciones

La propiedad ContentType se establece en null.

Ejemplos

En el ejemplo siguiente se establece la ContentType propiedad para la respuesta a image/jpeg, se llama al Clear método para quitar otro contenido que se pueda adjuntar a la respuesta y, a continuación, establece la BufferOutput propiedad en true para que la página completa se procese antes de que se envíe contenido al cliente solicitante.

Para obtener un ejemplo completo, vea la HttpResponse clase .

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

Se aplica a