Explanation:
If you are uing FormsAuthentication and a user who is not logged in tries to enter a secured page he is redirected to the Login page and the URL is appended with a ReturnUrl. After the user has been authenticated, the user is redirected to the earlier requested page.
I had no problem with this feature until I timed out and hit my LogOff page. I wasn't authenticated to see the LogOff page, so it appended that page URL to the ReturnURL and sent me the LogOn page. Once I logged in, it redirected me back to the LogOff page, which promptly logged me out.
I decided it would be easier to pick the start page for the user, regardless of what the ReturnUrl parameter was. Instead of using FormsAuthentication.RedirectFromLoginPage, use FormsAuthentication.SetAuthCookie and handle the Redirect yourself.
if (FormsAuthentication.Authenticate(txtName.Text, txtPassword.Text))
{
FormsAuthentication.SetAuthCookie(txtName.Text, true);
Response.Redirect("YourDefaultSecuredStartPage.aspx", true);
}
In above code user will be checked for authentication and will be returned to the menaul secured page which you want. If you are developing a Community based web page better location for FIRST redirect would be the user Home/Profile.
|
Visitors/Readers Comments
(for questions please use The Forum)

|
|
|
 |
|
|
 |
|
|
Add your Comments
|
|