共用方式為


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 方法不會清除標頭資訊。

適用於

另請參閱