Here's a very simple attribute I set up to require custom authentication on a controller action. You can use attributes like this to execute code before a controller action is run, such as in this case to perform authentication to check if the user has access to this method (if you're using a custom authentication scheme).
Set up another class module in your project called RequiresAuthenticationAttribute.cs
This will give you the attribute:
[RequiresAuthentication]
That you can use to decorate your methods, i.e.
[RequiresAuthentication] public ActionResult MySecureDashboard() { return View(); }
That's it!
Hope this helps
Comments
Please consider what you post!
Chillax if you're angry.