I check for a session variable in my asp.net page and redirect to my default page.
if (Session["OrgId"] != null)
{
// some logic
}
else
{
Response.Redirect("../Default.aspx?Sid=1", false);
}
and in my default.aspx page i ve done this,
Int64 id = GetId(Request.RawUrl.ToString());
if (id == 1)
{
// I ll show "Session Expired"
}
public Int64 GetId(string url)
{
Int64 id = 0;
if (url.Contains("="))
{
if (url.Length > url.Substring(url.LastIndexOf("=")).Length)
{
id = Convert.ToInt64(url.Substring(url.LastIndexOf("=") + 1));
}
}
return id;
}
This works in googlechrome,firefox but not in IE. “Operation aborted” exception.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
try changing
Response.Redirect("../Default.aspx?Sid=1", false);
to
Response.Redirect("../Default.aspx?Sid=1");
or
Response.Redirect("../Default.aspx?Sid=1", true);
Method 2
Redirect(String, Boolean)
Redirects a client to a new URL.
Specifies the new URL and whether
execution of the current page should
terminate.
That means that Response.Redirect("../Default.aspx?Sid=1", false); won’t terminate the current response.
Method 3
IE is much more sensitive than other browsers about changing the DOM after headers have been sent but before the page terminates.
Here is your problem:
Response.Redirect("../Default.aspx?Sid=1", false);
Try changing false to true.
Also, be very careful about the casing in your page names. “Default.aspx” and “default.aspx” are really not the same page even if Windows lets you get away with it.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0