Managing Buffer to post data outputs to client sideThrough buffering we can control the flow of data to user browser. We can send the date by chunk (or group ) before the complete processing of the page is done or we can send the outputs after the complete script execution is over. Many times we want to send some data for the visitor to read and meanwhile continue the processing of the script. Some time we don't want any data to be send to browser before the complete page processing is over. We can manage all these by handling the buffer.
Buffer is to be turned OFF if we want the data to go the client browser as and when processed. So at different time different outputs reaches the browser. If the Buffering is ON then all outputs are collected in the buffer and posted once the script execution is over. In IIS version 5.0 the buffer is ON by default.
We have to set the status of buffer before any output is posted, otherwise we will get error message. So best is to set the buffer status at the staring of the page. Any output if coming due to any warning or error message in script part will create problem if we keep the buffer just before the html tags.
The best way to test the buffer effect is to check the date and time up to seconds level by using now function and printing to screen.
<%@ Language=VBScript %>
Here in the above code two places the data or the output is to be posted to the user browser. Both the data are current date and time. So we can see the difference in seconds. If in your case the difference is too short or too high then adjust the looping number by changing number if zeros in for loop. Here you can see the for loop is there only to add some delay between two response.write statements printing the date and time to the user screen.