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 未清除标头信息。

适用于

另请参阅