tags:

views:

27

answers:

2

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?

+3  A: 

You should read about [Authorize] attribute and propably 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.

LukLed
+1  A: 

This and other q's answered in the nerd dinner tutorial. It's worth an afternoon going through. http://tinyurl.com/aspnetmvc (It's free)

No Refunds No Returns