Ryan Sampson
Ryan Sampson

Reputation: 6817

MVC - SQL Session State vs Storing values in db

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?

Upvotes: 3

Views: 2505

Answers (2)

Ryan Sampson
Ryan Sampson

Reputation: 6817

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

Upvotes: 0

Related Questions