Session Availability in ASP.Net MVC

21 May

We are in the process of porting one of our Web Forms apps to ASP.Net MVC. This is just something we stumbled upon…

this.Session is null in a Controller’s constructor.
Not a huge issue as you can use a Lazy Loading Pattern to circumvent it. It does raise the question of ‘why?’ though. The MVC (or Routing) framework is responsible for newing-up your Controllers to handle requests. Why couldn’t Session be spun up prior to this?
Leave a comment

Posted by on May 21, 2009 in ASP.Net MVC


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: