ASP.NET MVC: ensure user always has a session variable set
Posted
by pcampbell
on Stack Overflow
See other posts from Stack Overflow
or by pcampbell
Published on 2010-04-02T04:58:40Z
Indexed on
2010/04/02
5:03 UTC
Read the original article
Hit count: 821
asp.net-mvc
|session
Consider an ASP.NET MVC application that requires a session variable be set. It's used throughout the app. It'll be set by either reading a hashed value on the browser cookie, or after having the user login.
In the WebForms + Master Page model, I'd check the Page_Load() of the master page. Perhaps not the ultimate event, but it was an easy one to find.
How would you check and enforce the existance of a session variable in ASP.NET MVC? Consider that this question might not involve user login details, but some other piece of data (first visit time, perhaps).
© Stack Overflow or respective owner