Click here to Skip to main content
15,910,009 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,
I have used below coding to clear and abandon the session in javascript but its not working.used in logout click and redirect to home page.


PHP
if (confirm('Are You Sure to Logout?')) {
                   killsession();                  
                   location.href = "http://xxxx/home";
                  
               }


C#
function killsession() {
            Session.Clear();
            Session.Abandon();

        }
Posted
Comments
Mohibur Rashid 31-Jul-13 2:57am    
Suggestion : don't do that. Even if you javascript clear the cookie information, server will still keep your session info. You better clear your session from server. Also user can always turn off the browser by himself. Yet the better idea would be if you log out from server.

Think about a small virus that can send request to your server by reading your cookie. Very much possible. say, you have cleared your session in your browser still the virus can send those cookie to get info. And server will response cause the server is still keeping the session info

1 solution

try this link
clear session using javascript function[^]

Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900