Hi Expert,
In asp.net website i have use masterpage where i put one button for
logout option.
On master page load event i write following code for button text(login or logout).
if (Session["session_log_id"] == null)
{
lblUserName.Text = "";
buttLogin.Text = "Login";
}
else
{
lblUserName.Text = "<font color=#666666 size=2 face=Arial, Helvetica, sans-serif>Hi </font> , <font color=#822228 size=2 face=Arial, Helvetica, sans-serif>" + Session["session_logged_username"].ToString() + "</font>";
buttLogin.Text = "Logout";
}
On that buttons onclick event,i write code
Session.RemoveAll()
and redirect the user to Home page.
Upto this working fine for me.But after that when i hit back button it return to that page and show logout button again.
on each page load event i have write code like this to check wheather session is exist or not and prevent the unlogged user.
if (Session["session_log_id"] == null)
{
lblUserName.Text = "";
buttLogin.Text = "Login";
}
else
{
lblUserName.Text = "<font color=#666666 size=2 face=Arial, Helvetica, sans-serif>Hi </font> , <font color=#822228 size=2 face=Arial, Helvetica, sans-serif>" + Session["session_logged_username"].ToString() + "</font>";
buttLogin.Text = "Logout";
}
How to clear session completely , so user can not return back after logout?
Thanks in advance......