Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET HttpContext.Current.Session is suddenly always null

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.

like image 759
soupy1976 Avatar asked Aug 08 '26 21:08

soupy1976


1 Answers

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.

like image 126
soupy1976 Avatar answered Aug 11 '26 10:08

soupy1976



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!