Anmol, Browsers don't tell servers that the user is closing her browser though. You would have to try some sort of JavaScript for that solution. If you can manage that, only then could you invalidate the session.