P
patogenic
Internet Explorer 7 (not tested IE6) does not redirect if the page
*refreshed* when there is postdata(after posting data to server by
postback, form submit) and draws a blank page. There is no problem
with Opera 9.2 and Firefox 2.0.
I have tried the following suggestions to resolve the problem but they
do not help.
- Set SmartNavigation = false.
- Run "ASPNET_REGIIS.EXE -c".
I determined that the issue is not related to ASP.NET 2.0 as i watched
the sessions by Fiddler 2,
it is IE7 itself that does not regard the 3xx responses when page
refreshed.
Try the following on IE7 to reproduce problem;
1. Load the page "redir2.aspx"
2. Click "Do PostBack"
3. Refresh. Server responds with "Redirect Status" but browser does
not regard and draws a blank page.
4. Refresh. Server responds with the result as implied by the page
logic.
5. Refresh. Server responds with the result as implied by the page
logic.
Continuing to Refresh repeats the steps 3-5. Check out the
client,server and request counters.
I have performed some tests to get over this but none of them helped.
- Tried Redirect() with or without ending the response.
- Implemented RedirUrl() method to check with different variations
of "Redirect Response" to find out what causes IE7 fail with standard
redirection.
- responses with any 3xx status codes
- clearing Content and/or Headers
- Disabled session state.
- Disabled "Meta Refresh" security setting in IE7.
- Disabled Phishing Filter.
- Started IE7 without add-ons.
- Deleted cookies, temporary internet files.
Finally i have considered;
- It might be a feature of IE7 to prevent page refreshes when there
is postdata but i am not sure that its complete.
- Redirection with immediate meta refresh works but not a good
practice.
- Appending a random value to the redirection url gets IE7 perform
the redirection so it may be a caching problem with IE7.
- Server.Transfer() is a better solution for this case but i'd like
know what is happening with IE7 in this case. Is it a bug, feature or
misuse of the browser?
- Don't ask why or for what reason i implement this logic. I was
experimenting the page refresh preventing after form submit(postback)
and find myself coping with this issue of IE7.
~~~~~~~~~~~~~~~~~~~~~~~~~
Check the page online at http://patogenic.somee.com/redir2.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class redir2 : System.Web.UI.Page
{
protected void RedirUrl(string theURL, bool endResponse)
{
Response.ClearHeaders(); // Sets Status Code to 200.
Response.Clear();
/*Response.Status = "301 Moved Permanently";
Response.StatusCode = 301;*/
Response.Status = "302 Object moved";
Response.StatusCode = 302;
/* StatusCode values 302 and 200 does not make difference
* when Status value is set to whatever intentioned.*/
Response.AddHeader("Location", theURL);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.Write(@"<a href="" mce_href=""" + theURL +
@""">Object moved to there</a>");
if (endResponse)
Response.End();
}
protected void RedirViaMeta(string theURL)
{
Response.ClearHeaders();
Response.Clear();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(string.Format(@"<meta http-equiv=""refresh""
content=""0;url={0}"" />", theURL));
Response.End();
}
public int ClientCnt;
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
bool _IsPostBack = Request.Form.Count > 0;
Application["RequestCnt"] = (int)(Application["RequestCnt"] ??
0) + 1;
lit1.Text = DateTime.Now + " <br>IsPostBack : " + _IsPostBack
+
" <br>Request Counter : " + Application["RequestCnt"];
if (Request.Form["btnRedir"] != null)
{
Response.Redirect("redir2.aspx", true);
return;
}
int ServerCnt;
if (_IsPostBack)
{
ServerCnt = (int)(Application["ServerCnt"] ?? 0);
int.TryParse(Request.Form["ClientCnt"], out ClientCnt);
}
else
{
ServerCnt = 0;
ClientCnt = 0;
Application["RequestCnt"] = 0;
}
ServerCnt++;
Application["ServerCnt"] = ServerCnt;
ClientCnt++;
//SmartNavigation = false;
lit1.Text += " <br>Server Counter : " + ServerCnt;
// Postback refreshed.
if (ClientCnt < ServerCnt)
{
Application["ServerCnt"] = 0;
//Server.Transfer("redir2.aspx", false);
//RedirUrl("redir2.aspx", true);
//RedirViaMeta("redir2.aspx");
Response.Redirect("redir2.aspx", true);
return;
}
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~
*refreshed* when there is postdata(after posting data to server by
postback, form submit) and draws a blank page. There is no problem
with Opera 9.2 and Firefox 2.0.
I have tried the following suggestions to resolve the problem but they
do not help.
- Set SmartNavigation = false.
- Run "ASPNET_REGIIS.EXE -c".
I determined that the issue is not related to ASP.NET 2.0 as i watched
the sessions by Fiddler 2,
it is IE7 itself that does not regard the 3xx responses when page
refreshed.
Try the following on IE7 to reproduce problem;
1. Load the page "redir2.aspx"
2. Click "Do PostBack"
3. Refresh. Server responds with "Redirect Status" but browser does
not regard and draws a blank page.
4. Refresh. Server responds with the result as implied by the page
logic.
5. Refresh. Server responds with the result as implied by the page
logic.
Continuing to Refresh repeats the steps 3-5. Check out the
client,server and request counters.
I have performed some tests to get over this but none of them helped.
- Tried Redirect() with or without ending the response.
- Implemented RedirUrl() method to check with different variations
of "Redirect Response" to find out what causes IE7 fail with standard
redirection.
- responses with any 3xx status codes
- clearing Content and/or Headers
- Disabled session state.
- Disabled "Meta Refresh" security setting in IE7.
- Disabled Phishing Filter.
- Started IE7 without add-ons.
- Deleted cookies, temporary internet files.
Finally i have considered;
- It might be a feature of IE7 to prevent page refreshes when there
is postdata but i am not sure that its complete.
- Redirection with immediate meta refresh works but not a good
practice.
- Appending a random value to the redirection url gets IE7 perform
the redirection so it may be a caching problem with IE7.
- Server.Transfer() is a better solution for this case but i'd like
know what is happening with IE7 in this case. Is it a bug, feature or
misuse of the browser?
- Don't ask why or for what reason i implement this logic. I was
experimenting the page refresh preventing after form submit(postback)
and find myself coping with this issue of IE7.
~~~~~~~~~~~~~~~~~~~~~~~~~
Check the page online at http://patogenic.somee.com/redir2.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class redir2 : System.Web.UI.Page
{
protected void RedirUrl(string theURL, bool endResponse)
{
Response.ClearHeaders(); // Sets Status Code to 200.
Response.Clear();
/*Response.Status = "301 Moved Permanently";
Response.StatusCode = 301;*/
Response.Status = "302 Object moved";
Response.StatusCode = 302;
/* StatusCode values 302 and 200 does not make difference
* when Status value is set to whatever intentioned.*/
Response.AddHeader("Location", theURL);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.Write(@"<a href="" mce_href=""" + theURL +
@""">Object moved to there</a>");
if (endResponse)
Response.End();
}
protected void RedirViaMeta(string theURL)
{
Response.ClearHeaders();
Response.Clear();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(string.Format(@"<meta http-equiv=""refresh""
content=""0;url={0}"" />", theURL));
Response.End();
}
public int ClientCnt;
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
bool _IsPostBack = Request.Form.Count > 0;
Application["RequestCnt"] = (int)(Application["RequestCnt"] ??
0) + 1;
lit1.Text = DateTime.Now + " <br>IsPostBack : " + _IsPostBack
+
" <br>Request Counter : " + Application["RequestCnt"];
if (Request.Form["btnRedir"] != null)
{
Response.Redirect("redir2.aspx", true);
return;
}
int ServerCnt;
if (_IsPostBack)
{
ServerCnt = (int)(Application["ServerCnt"] ?? 0);
int.TryParse(Request.Form["ClientCnt"], out ClientCnt);
}
else
{
ServerCnt = 0;
ClientCnt = 0;
Application["RequestCnt"] = 0;
}
ServerCnt++;
Application["ServerCnt"] = ServerCnt;
ClientCnt++;
//SmartNavigation = false;
lit1.Text += " <br>Server Counter : " + ServerCnt;
// Postback refreshed.
if (ClientCnt < ServerCnt)
{
Application["ServerCnt"] = 0;
//Server.Transfer("redir2.aspx", false);
//RedirUrl("redir2.aspx", true);
//RedirViaMeta("redir2.aspx");
Response.Redirect("redir2.aspx", true);
return;
}
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~