tags:

views:

49

answers:

2

When is the Session property in Controller Initialized?

From what I see it is not initialized when the constructor is called. So when it's initialized?

A: 

Ah, I found a related post myself at StackOverflow. It seems that it's definitely not initialized during constructor, but when it's initialized is still an unknown.

Any ideas?

Ngu Soon Hui
+3  A: 

It looks to me from the source, that the controller context (which contains the HttpContext and thus the Session) is provided to the controller when the action is invoked by the ControllerActionInvoker. It's also available to filters via the filter's context object on the filter's main methods.

tvanfosson