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,
Int开发者_开发百科64 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.
try changing
Response.Redirect("../Default.aspx?Sid=1", false);
to
Response.Redirect("../Default.aspx?Sid=1");
or
Response.Redirect("../Default.aspx?Sid=1", true);
HttpResponse.Redirect Method
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.
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.
精彩评论