I’m doing a simple check for some user data that get’s put into session on sign in. What happens, is I click through a few buttons to get to this page. This page a has a drop down that is set to autopostback=true.
When I change my selection in the drop, my request get’s redirected to a page that doesn’t exist. signin.aspx exists in the root folder of the site. The attempted redirect looks for signin in the folder that this particular page is in (example.com/folder1/signin.aspx) instead of example.com/signin.aspx.
Should I be using something other than Response.Redirect to accomplish this?
Side note about the application:
This is .net 4 using jquery 1.6.4 and jquerymobile 1.0. I’m thinking jquery mobile is the problem because I use this same pattern/practice on other applications without issue.
Location of page where this is happening.
example.com/folder1/page2.aspxlocation of sign in page: example.com/signin.aspx
url that displays in the error. example.com/folder1/signin.aspx
protected override void OnInit(EventArgs e)
{
if (Session["UserData"] == null)
{
Response.Redirect("../SignIn.aspx");
}
}
You should always use asp.net style root-relative paths:
That makes the URL relative to your site’s root (not the web root unless your site is the web root), but still allows the site to be moved around.