Asp.net Session Abandon

Asp.net Session Abandon

Session.Abandon() cancels current session. Let’s see how to call abandon method of Session.

Example Aspx page code.

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

Code behind

public partial class _Default : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
    {
      
    }
  protected void Button1_Click(object sender, EventArgs e)
  {
     Session.Abandon();
  }
}

Tags:

How are you using session variables in Asp.net with C#.netAsp.net Session TimeoutIRequiresSessionState and sessionSessions In AspnetAsp.net SessionAsp.net Interview Questions for 2 years or 3 years experianceSession application viewstateSession Loss In WebgardenWhat is web garden in Asp.net?How to implement Captcha in Asp.netasp net image upload

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.