title: How to get session timeout notification in ASP.NET Core MVC?
body: <p>I need to release some resources (call a C++ DLL) upon session expiration. I thought of storing an object in session and releasing the resources in its destructor. But it seems that ASP.NET Core MVC doesn't allow to store non-primitive types in session. Is there some other way to achieve this? Perhaps I can subscribe to some notification of session expiration.</p>