是否有Session.Abandon()asp.net Core [英] Is there Session.Abandon() asp.net Core

查看:216
本文介绍了是否有Session.Abandon()asp.net Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Asp.net WebForms中,global.asax中有一个称为Seesion_End()的事件,每当会话超时或您调用Session.Abandon()时,都会执行此事件处理程序,因此我需要在ASP中具有类似的行为。 net Core,有可能吗?

In Asp.net WebForms there is an event called Seesion_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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆