@manhnguyenv

Welcome to my blog!

Session

April 10, 2018 16:39

Working with the ASP.NET Global ASAX file

https://www.techrepublic.com/article/working-with-the-aspnet-globalasax-file/

https://msdn.microsoft.com/en-us/library/ms178473.aspx

https://stackoverflow.com/questions/345343/simplest-way-to-count-visits-asp-net-web-app

How do I use Session_Start in ASP.NET MVC?

void Session_Start(object sender, EventArgs e) {
            if (HttpContext.Current.Session == null)
            {
                Debug.WriteLine("null session");
            }
            else
            {
                Debug.WriteLine("There is a session");
                HttpContext.Current.Session["Foo"] = 100;
                HttpContext.Current.Session["Bar"] = "Abc";
            }
 }
<system.web>
  <sessionState cookieName="auth" mode="InProc" timeout="480"/>
</system.web>

Categories