When i setup an MVC 3 project, there is an implementation of user register and login.
I want to be able to password protect the pages with session? How can i do this?
There are similar questions but no details on implementation. If the user is not logged in, user shouldnt be able to access to pages.I want to password protect the pages.How can I implement this?
When i setup an MVC 3 project, there is an implementation of user register
Share
Just add
[Authorize]attribute to actions that must be not visible to not logged in users.Also you can add this attribute to whole controller, so in this case all actions in that controller will be unreachable to not logged in users.