How to use Session_Start in ASP.NET MVC?

This is rather strange, I thought that just adding this code to Global.asax.cswould be enough:

void Session_Start(object sender, EventArgs e) {
  // your code here, it will be executed upon session start
}

But the method is not called ... How to enable the ASP.NET method Session_Startwhen starting a session?

I cannot figure out how to catch a session creation event.

+4
source share
1 answer

Yes, that’s enough ... when you turned on the sessions:

<system.web>
  <sessionState cookieName="auth" mode="InProc" timeout="480"/>
</system.web>
+4
source

Source: https://habr.com/ru/post/1673616/


All Articles