How to expire a Session if we click Browser Back Button
-
Hi Gurus, I have a Login Page. First i have logged in and browsed the Site, then with out Logging out, I navigate to login page by clicking Browers Back Button, Now here when i click Forward button it is logging into the site, But at this point the session should expire. Can any one provide the Code for the above Senario. I will be greatful to u all,
with thanks and regards, kaushik pulpa
-
Hi Gurus, I have a Login Page. First i have logged in and browsed the Site, then with out Logging out, I navigate to login page by clicking Browers Back Button, Now here when i click Forward button it is logging into the site, But at this point the session should expire. Can any one provide the Code for the above Senario. I will be greatful to u all,
with thanks and regards, kaushik pulpa
kaushik490 wrote:
But at this point the session should expire
When you click Log Out Button make your session =null;
Session["UserName"] = null; Session["Password"] = null;
Also you can do one thing add this code in every page load eventResponse.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); //or a date much earlier
OK Are you checking the Session in every page ? i.e validating the user in every page ?Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
kaushik490 wrote:
But at this point the session should expire
When you click Log Out Button make your session =null;
Session["UserName"] = null; Session["Password"] = null;
Also you can do one thing add this code in every page load eventResponse.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); //or a date much earlier
OK Are you checking the Session in every page ? i.e validating the user in every page ?Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
Thanks for ur Reply buddy, I will check it and reply again byeeeeeeeee
with thanks and regards, kaushik pulpa
-
Hi Gurus, I have a Login Page. First i have logged in and browsed the Site, then with out Logging out, I navigate to login page by clicking Browers Back Button, Now here when i click Forward button it is logging into the site, But at this point the session should expire. Can any one provide the Code for the above Senario. I will be greatful to u all,
with thanks and regards, kaushik pulpa
Have you looked at the member functions for the SessionState object[^]? Clear and Abandon may be interesting to you.
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
Have you looked at the member functions for the SessionState object[^]? Clear and Abandon may be interesting to you.
cheers, Chris Maunder
CodeProject.com : C++ MVP
but i think we dint solve the requirement here.The question was how do we expire a session when browser back button is pressed? i would also like to know how to abandon a session in case of browser close event. any suggestion or help is welcome thnks for ur effort
Rama Charan Prasad "Be happy and Keep smiling.Thats what u want be always..:)"