Why would ASP.NET MVC use session state?

Posted by ray247 on Stack Overflow See other posts from Stack Overflow or by ray247
Published on 2008-12-22T19:41:06Z Indexed on 2010/04/17 5:23 UTC
Read the original article Hit count: 284

Filed under:
|

Recommended by the ASP.NET team to use cache instead of session, we stopped using session from working with the WebForm model the last few years. So we normally have the session turned off in the web.config

<sessionState mode="Off" />

But, now when I'm testing out a ASP.NET MVC application with this setting it throw an error in class SessionStateTempDataProvider inside the mvc framework, it asked me to turn on session state, I did and it worked. Looking at the source it uses session

Dictionary<string, object> tempDataDictionary = httpContext.Session[TempDataSessionStateKey] as Dictionary<string, object>; // line 20 in SessionStateTempDataProvider.cs

So, why would they use session here? What am I missing?

Thanks,

Ray.

========================================================

Edit Sorry didn't mean for this post to debate on session vs. cache, but rather in the context of the ASP.NET MVC, I was just wondering why session is used here. In this Scott Watermasysk blog post he mentioned on turning off session too as a good practice, so I'm just wondering do I have to turn it on to use MVC from here on?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about session-state