Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Response.BufferOutput = False, not working?

This problem started on a different board, but Dave Ward, who was very prompt and helpful there is also here, so I'd like to pick up here for hopefully the last remaining piece of the puzzle.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

Basically, I was looking for a way to do constant updates to a web page from a long process. I thought AJAX was the way to go, but Dave has a nice article about using JavaScript. I integrated it into my application and it worked great on my client, but NOT my server WebHost4Life. I have another server @ Brinkster and decided to try it there and it DOES work. All the code is the same on my client, WebHost4Life, and Brinkster, so there's obviously something going on with WebHost4Life.

I'm planning to write an email to them or request technical support, but I'd like to be proactive and try to figure out what could be going on with their end to cause this difference. I did everything I could with my code to turn off Buffering like Page.Response.BufferOutput = False. What server settings could they have implemented to cause this difference? Is there any way I could circumvent it on my own without their help? If not, what would they need to do?

For reference, a link to the working version of a simpler version of my application is located @ http://www.jasoncomedy.com/javascriptfun/javascriptfun.aspx and the same version that isn't working is located @ http://www.tabroom.org/Ajaxfun/Default.aspx. You'll notice in the working version, you get updates with each step, but in the one that doesn't, it sits there for a long time until everything is done and then does all the updates to the client at once ... and that makes me sad.

like image 398
Jason Shoulders Avatar asked Aug 24 '08 03:08

Jason Shoulders


4 Answers

Hey, Jason. Sorry you're still having trouble with this.

What I would do is set up a simple page like:

protected void Page_Load(object sender, EventArgs e)
{
  for (int i = 0; i < 10; i++) 
  {
    Response.Write(i + "<br />"); 
    Response.Flush();

    Thread.Sleep(1000);
  }
}

As we discussed before, make sure the .aspx file is empty of any markup other than the @Page declaration. That can sometimes trigger page buffering when it wouldn't have normally happened.

Then, point the tech support guys to that file and describe the desired behavior (10 updates, 1 per second). I've found that giving them a simple test case goes a long way toward getting these things resolved.

Definitely let us know what it ends up being. I'm guessing some sort of inline caching or reverse proxy, but I'm curious.

like image 161
Dave Ward Avatar answered Nov 18 '22 20:11

Dave Ward


I don't know that you can force buffering - but a reverse proxy server between you and the server would affect buffering (since the buffer then affects the proxy's connection - not your browser's).

like image 29
Mark Brackett Avatar answered Nov 18 '22 21:11

Mark Brackett


I've done some fruitless research on this one, but i'll share my line of thinking in the dim hope that it helps.

IIS is one of the things sitting between client and server in this case, so it might be useful to know what version of IIS is involved in each case -- and to investigate if there's some way that IIS can perform its own buffering on an open connection.

Though it's not quite on the money, this article about IIS6 v IIS 5 is the kind of thing I'm thinking of.

like image 2
Leon Bambrick Avatar answered Nov 18 '22 22:11

Leon Bambrick


You should make sure that neither IIS nor any other filter is trying to compress your response. It is very possible that your production server has IIS compression enabled for dynamic pages such as those with the .aspx suffix, and your development server does not.

If this is the case, IIS may be waiting for the entire response (or a sizeable chunk) before it attempts to compress and send any result back to the client.

I suggest using Fiddler to monitor the response from your production server and figure out if responses are being gzip'd.

If response compression does turn out to be the problem, you can instruct IIS to ignore compression for specific responses via the Content-Encoding:Identity header.

like image 2
kamens Avatar answered Nov 18 '22 20:11

kamens