是否有 Session.Abandon() asp.net Core [英] Is there Session.Abandon() asp.net Core
本文介绍了是否有 Session.Abandon() asp.net Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Asp.net WebForms 中,global.asax 中有一个名为 Session_End() 的事件,每当会话超时或您调用 Session.Abandon() 时,都会执行此事件处理程序,我需要在 asp 中具有类似的行为.net Core,有可能吗?
In Asp.net WebForms there is an event called Session_End() in global.asax, whenever session is timeout or you call Session.Abandon() this event handler is executed, i need to have similar kind of behavior in asp.net Core, is it possible?
推荐答案
您可以通过简单的调用来清除会话:
You could clear the session by simply calling:
HttpContext.Session.Clear();
这篇关于是否有 Session.Abandon() asp.net Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文