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?
相关问题
- Dotnet Core API - Get the URL of a controller meth
- Why am I unable to run dotnet tool install --globa
- Can I use MvcJsonOptions configured during Startup
- Singleton with AsyncLocal vs Scope Service
- What would prevent code running in a Docker contai
相关文章
- DotNet Core console app: An assembly specified in
- EF Core 'another instance is already being tra
- Re-target .NET Core to net471, net 472
- How to replace Middleware in integration tests pro
- Why CsvHelper not reading from MemoryStream?
- How to define function that returns html in asp.ne
- Publishing a Self-contained Console app fails
- Calling a .Net Framework 4 (or Mono) assembly from
The docs cover most of this. The session timeout is set like this:
But since it exists is a cookie, the cookie also has an expiration date. So if
IdleTimeout
expires, the session expires. If the cookie expires, the session is gone. If the cookie is deleted, the session is gone.Calling
Session.Clear()
removes the contents of the session, but keeps the session intact (aka, the cookie isn't deleted) as described in the source.You could clear the session by simply calling:
HttpContext.Session.Clear();