I have a Sing In page which is responsible for checking user credentials.
if the result of checking the credentials is OK, the user will be directed to the Main (Home) Page.
If the user click Sing Out in the Main (Home) Page, the user will be directed to the Sing In Page.
The problem is , once the user have signed out and click Back Button in the browser she/he is still able to navigate to the previous pages.
How to avoid navigating back after singing out? Or (what is the best solution)
* I used session for authentication.
Regadrds
White Dove
Thats a good point. I never did notice it. Not sure but maybe setting the page with no cache will help?Sign In Code:
// The following code is executed after you have gone through the database to find the user
string userName = "John";// You will use some method here like GetUserName(string email) which returns the userID
if(userName !=null && userName!= "")
{
// For the second parameter you can also use Checkbox value CheckBox1.Checked
FormsAuthentication.SetAuthCookie(txtUserName.Text,true);
Response.Redirect("RequestedPage.aspx");
}
Sign out Code:
FormsAuthentication.SignOut();
Response.Cookies["UserName"].Value =null;
// The date can be anything which has already passed
Response.Cookies["UserName"].Expires =new System.DateTime(1999,10,12);
Response.Redirect("Whateverpage.aspx");
oops..sorry, posted in the wrong page.
0 comments:
Post a Comment