Reading conflicting opinions on using SQL session state vs custom db table in MVC to store user data across page requests?
开发者_如何学编程What are the advantages and disadvantages to each method? Why should I pick one method over the other.
So far it seems a custom db table is the best solution because it doesn't time out, plus it would be strongly typed using the Entity Framework.
Am I missing something?
These articles outline strategy and performance for the various methods of Session storage.
- ASP.NET Session State FAQ
- Selecting the Method for Maintaining and Storing ASP.NET Session State
- ASP.NET Session State: Architectural and Performance Considerations
- ASP.NET Cache and Session State Storage
Seems like SQL session state is the way to go if you need your data to expire, otherwise a custom database table seems like the way to go. Especially when using entity framework, less work to setup and you get a strongly typed object. No Session["VarName"] stuff..
精彩评论