How to mark an action method public in secure controller?
To make an action method public in secure controller, we can mark them as
Anonymous
.
CONTROLLER CODE
[Authorize] public class AuthorizeController : Controller { [AllowAnonymous] public ActionResult PublicPage() { return View(); } }
In above case, even if the controller is marked as secure (decorated with
Authorize
attribute), the PublicPage (the name of method can be anything else) action method will be accessible for all user even without logging in.
No comments:
Post a Comment