HttpResponse.Clear 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
清除緩衝區串流中的所有內容輸出。
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 方法不會清除標頭資訊。