Why Can't I Turn Buffering Off Using Response.Buffer?

For several reasons, mostly performance and the ability to handle 500 errors more flexibly, buffering is enabled by default in IIS 5.0, 5.1 and 6.0. In IIS 4.0, buffering was disabled by default, so you could enable it and disable it at will. Now, when you create an ASP page such as the following:
 

<% 
    Response.Buffer = False 
    ' ... 
%>

You will most likely see this error: 

Response object error 'ASP 0157 : 80004005'  
Buffering On  
/<file>.asp, line <line>  
Buffering cannot be turned off once it is already turned on.

 
When buffering is enabled by default, you cannot override it at page scope. To do so, you have to disable buffering for the entire web site / application, then enable buffering in each page as required. To do this, open Internet Services Manager, right-click the web site or application, and select properties. On the Home Directory tab, click the Configuration button, and on the Options tab, uncheck "Enable Buffering"... but don't be surprised if the rest of your app starts behaving weird.

  • 0 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?