Oscar Oscar - 3 months ago 13
ASP.NET (C#) Question

Why doesn't this page redirect work in IE?

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.

Answer

try changing

 Response.Redirect("../Default.aspx?Sid=1", false);

to

 Response.Redirect("../Default.aspx?Sid=1"); 

or

Response.Redirect("../Default.aspx?Sid=1", true);