I have a simple ASP.Net MVC 3 application that has some controller and a good few actions.
Now, as this is a user based application, most of the controller actions require the user to be authenticated. MVC handles this well with the built-in Authorize attribute which you can use to decorate controllers and/or actions individually.
The great thing is you can apply the attribute to just the controller and all actions for that given controller will have it applied too - lots of typing saved ;)
But I have one controller with, lets say, 10 actions. But I want one of the actions to not have the Authorize attribute applied.
Yes, I could apply the attribute to the other 9 and remove it from the controller which will do exactly what I need. But is there a way to keep it applied to the controller and just choose to exclude one of the actions?
Effectively, would want something like...
[!Authorize]
or [NotAuthorize]
I know I could create a custom one that will do the job, but what I want to know is if there is a built-in way to do this? or do I have to apply the attribute to all 9 other actions?