开发者

MVC - SQL Session State vs Storing values in db

开发者 https://www.devze.com 2023-01-11 16:47 出处:网络
Reading conflicting opinions on using SQL session state vs custom db table in MVC to store user data across page requests?

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..

0

精彩评论

暂无评论...
验证码 换一张
取 消