some actions shouldn’t be run unless the user is logged in.
I just want to do something like:
[MustBeLoggedIn]
public ActionResult Blah()
{
}
is that hard?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should read about [Authorize] attribute and probably FormsAuthentication.
This blog entry shows overview:
ASP.NET 2.0 Forms authentication – Keeping it customized yet simple
This is another page about forms authentication:
Explained: Forms Authentication in ASP.NET 2.0
When you use forms authentication, set IPrincipal in proper place [Authorize] attribute will do what you want.