HttpResponse.ContentType Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta il tipo MIME HTTP del flusso di 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
Valore della proprietà
Tipo MIME HTTP del flusso di output. Il valore predefinito è "text/html".
Eccezioni
La proprietà ContentType è impostata su null.
Esempio
Nell'esempio seguente la proprietà per la ContentType risposta a image/jpeg chiama il Clear metodo per rimuovere altri contenuti che potrebbero essere associati alla risposta e quindi imposta la BufferOutput proprietà su true in modo che la pagina completa venga elaborata prima dell'invio di contenuto al client richiedente.
Per un esempio completo, vedere la HttpResponse classe .
// 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