Wednesday 12 February 2014

How to clear all Session value and close current window using asp.net

In this article I will explain how to clear all Session value and close current window using asp.net.

Below code is useful for remove all session values and close the current window.

Session.Abandon() method is useful for clearing all session values in the application.

FormsAuthentication.SignOut();
Session.Abandon();


ScriptManager.RegisterClientScriptBlock(…..) is useful for closing the current window.  


ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Close_Window", "self.close();", true);


Total Code :

FormsAuthentication.SignOut();
Session.Abandon();

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Close_Window", "self.close();", true);


No comments:

Post a Comment