Search code examples
asp.net-mvc-3authorizationrole

How to make a particular action publicly available while keeping everything else private


I was able to successfully implement FormsAuthentication and use the Authorize Attribute to control which roles are authorized to access the different controllers and actions. I want to allow one particular action to be publicly available but It always send me to the login form.

I've tried using

[Authorize(Users="?")]

or

[Authorize(Users="*")]

but both send me to the login form.

however [Authorize(Users="Admin")] will only send non admin user to the login form as expected. Is this possible to do? Thank you.


Solution

  • I was able to accomplish what I wanted to do by following this article: http://blogs.msdn.com/b/rickandy/archive/2011/05/02/securing-your-asp-net-mvc-3-application.aspx