Reputation: 2845
Had an issue with and ASP.NET MVC4 application where it had been running perfectly, and was pulling/pushing various objects in and out of session.
After a problem with my machine, all of a sudden HttpContext.Current.Session was always throwing null reference exceptions whenever it was referenced.
This was not due to a code change, but obviously a problem with my machine.
Upvotes: 3
Views: 1118
Reputation: 2845
The problem was that after my machine had crashed and restarted, the ASP.NET State Service (Named aspnet_state) was no longer running. I went into windows services and started that service up and session started working correctly again.
It took me a while to find the answer to this, and couldn't see it anywhere on SO so I thought worth adding in case it helps someone.
Upvotes: 3