How do I use Session_Start in ASP.NET MVC?
10,670
Yes, that is enough ... when you have enabled sessions:
<system.web>
<sessionState cookieName="auth" mode="InProc" timeout="480"/>
</system.web>
Author by
Antoine Pelletier
I'm a web developer, and a web app manager. I mostly use ASP.Net, MVC, C#, Entity Framework, SQL server and Ajax. I'm a french Canadien, so yes, I do play hockey :)
Updated on June 15, 2022Comments
-
Antoine Pelletier almost 2 years
It's quite weird, I thought that simply adding this code in the
Global.asax.cs
would be enough:void Session_Start(object sender, EventArgs e) { // your code here, it will be executed upon session start }
But the method isn't called... How do I let ASP.NET call a the
Session_Start
method when the session starts?I can't figure how to catch the event of a session creation.