Session Id changes in ASP.NET MVC on every new page request

I faced and issue in ASP.NET MVC application where the value of SessionID variable changes on consecutive page requests.

The reason is either you don't have a Global.asax file in your solution, or you have a global.asax in your solution without the definition of session end and session start. So the web server actually doesn't take care of session start and end event per application basis, and it generates a new key on every page request.
You should have a Global.asax in your project and it shall have following two functions added:

       protected void Session_Start()
        { }

        protected void Session_End()
        { }
    

This should work perfectly.......
Enjoy coding!

Comments

Popular posts from this blog

SharePoint log error "Cannot find site lookup info for request Uri http://"

Visual Studio Build Issue : Build: 0 succeeded or up-to-date, 0 failed, 1 skipped

Reset your SharePoint Farm PassPhrase