J
Jeremy Chapman
I have built a web app. While testing I have found that if I browse to a
page in the app, then get redirected to the login page and enter my
credentials. The FormsAuthentication.RedirectFromLoginPage call is
redirecting to the default.aspx page rather than the original page the user
was at.
Here is the details of my application:
Web.config:
<authentication mode="Forms">
<forms name="Login.APSXAUTH"
loginUrl="login.aspx"
timeout="20"
protection="All"
path="/"/>
</authentication>
In each page of my application (with the exception of the login.aspx)
checks a variable in the Session. If the value is null, then a call to
Response.Redirect("login.aspx",false) is done.
When inspecting Request object in the page load of login.aspx when the
redirect first takes place, I can see that the URLReferrer is correct.
I then enter my credentials in the login page, and click a submit button.
When inspecing the Request object in the submit button click event at this
point, the URLReferrer points to my default.aspx page, not the page that
originally redirected me to the login.aspx page. As well, if I make a call
to FormsAuthentication.GetRedirectUrl, it returns the default.aspx. Making a
call to FormsAuthentication.RedirectFromLoginPage(username, false) redirects
me to the default.aspx and not the original page I was browsing. Is there
some additional things I need to do to determine the correct page to
redirect to?
page in the app, then get redirected to the login page and enter my
credentials. The FormsAuthentication.RedirectFromLoginPage call is
redirecting to the default.aspx page rather than the original page the user
was at.
Here is the details of my application:
Web.config:
<authentication mode="Forms">
<forms name="Login.APSXAUTH"
loginUrl="login.aspx"
timeout="20"
protection="All"
path="/"/>
</authentication>
In each page of my application (with the exception of the login.aspx)
checks a variable in the Session. If the value is null, then a call to
Response.Redirect("login.aspx",false) is done.
When inspecting Request object in the page load of login.aspx when the
redirect first takes place, I can see that the URLReferrer is correct.
I then enter my credentials in the login page, and click a submit button.
When inspecing the Request object in the submit button click event at this
point, the URLReferrer points to my default.aspx page, not the page that
originally redirected me to the login.aspx page. As well, if I make a call
to FormsAuthentication.GetRedirectUrl, it returns the default.aspx. Making a
call to FormsAuthentication.RedirectFromLoginPage(username, false) redirects
me to the default.aspx and not the original page I was browsing. Is there
some additional things I need to do to determine the correct page to
redirect to?