soupy1976
soupy1976

Reputation: 2845

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.

Upvotes: 3

Views: 1118

Answers (1)

soupy1976
soupy1976

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

Related Questions