mwrock / RequestReduce

Instantly makes your .net website faster by reducing the number and size of requests with almost no effort.
www.requestreduce.org
Apache License 2.0
228 stars 48 forks source link

Request Reduce does not fire after Server.Execute #210

Closed neilbaylor closed 12 years ago

neilbaylor commented 12 years ago

Hey there

I'm working on a system that uses quite a bit of Server.Execute under the hood.

I'm finding that all the pages that use Server.Execute don't get Request Reduce enabled.

For example, pulling up this page in the browser will have request reduce enabled http://localhost/page.aspx?id=4

however executing this code on a new page will not enable request reduce.

protected void Page_Load(object sender, EventArgs e) { Server.Execute( "page.aspx?id=4" ); }

neilbaylor commented 12 years ago

Upon further investigation, this appears to occur ONLY when response.end is called.

Example:

protected void Page_Load(object sender, EventArgs e) { Server.Execute( "page.aspx?id=4" ); Response.End(); //commenting out this line will make RequestReduce fire }

mwrock commented 12 years ago

Yes. Response.end terminates the thread and that cuts off rr before it attaches to the response. RR waits until the response is rendered so it can be sure it s working on html or xhtml.you can force rr to attach to the responses sooner using the API.