mrblah
mrblah

Reputation: 103517

simple filter I can add to my controller actions that check authentication

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?

Upvotes: 0

Views: 77

Answers (2)

LukLed
LukLed

Reputation: 31842

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.

Upvotes: 3

No Refunds No Returns
No Refunds No Returns

Reputation: 8336

This and other q's answered in the nerd dinner tutorial. It's worth an afternoon going through. (It's free)

Upvotes: 1

Related Questions