共用方式為


HttpResponse.Clear 方法

定義

從緩衝區資料流清除所有內容輸出。

public:
 void Clear();
public void Clear ();
member this.Clear : unit -> unit
Public Sub Clear ()

範例

下列範例會 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

備註

方法 Clear 不會清除標頭資訊。

適用於

另請參閱