How to Kill A Session or Session ID (ASP.NET/C#)

前端 未结 9 1301
礼貌的吻别
礼貌的吻别 2020-11-30 04:09

How can I destroy a session (Session[\"Name\"]) when the user clicks the logout button?

I\'m looking through the ASP.NET API Reference on MSDN and it doesn\'t seem t

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 04:36

    Session.Abandon(); did not work for me either.

    The way I had to write it to get it to work was like this. Might work for you too.

    HttpContext.Current.Session.Abandon();
    

提交回复
热议问题