Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 

YOU ARE HERE: HOME Questions How Response Flush works fine in combination with Server Execute



How Response.Flush works in Server.Execute

View(s): 13744

How Response.Flush works fine in combination with Server.Execute?

Answer 1)


Generally we will end up with exceptions when we use Response.Flush and redirect the page using Response.Redirect. But same will works fine using Server.Execute.

In general, you can use Response.Flush statement as many times as you want. But you can not send any additional HTTP headers to browser once ASP.NET flushes the content to browser. So sending of HTTP headers should happen before 1st Response.Flush statement.

//Page1.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
    Server.Execute("Page2.aspx");
}

Observer the above code. It’s calling Server.Execute("Page2.aspx") from Page1.aspx Page_Load method.

Meaning of above code is,

  1. Include the page content of Page2.aspx in Page1.aspx,
  2. And HTTP headers generated by Page2.aspx will be ignored.
The end result will contain the content of Page1.aspx + Page2.aspx.

But whereas Response.Redirect sends HTTP header (“location:” http header) to the browser, so browser will request the new page specified in the “location http header”. But remember the problem with Response.Flush, ASP.NET can not send any HTTP headers once some content already sent to browser. That is the reason Response.Redirect will not work with combination with Response.Flush, but whereas Server.Execute can.

  Asked in:  ValueLabs   Expertise Level:  Experienced
  Last updated on Wednesday, 05 February 2014
2/5 stars (8 vote(s))

Register Login Ask Us Write to Us Help