How can I set authorization to a particular action within a controller?

How to authorize particular Action in asp.net mvc

Exclude some actions from Authorize in ASP.net MVC

Remove some actions from Authorize in ASP.net MVC

Example

[Authorize]
public class PersonController : Controller
{

public ActionResult Index()
{
…..
}
public ActionResult Add()
{
…….
}

}


Change with the above code from below given code
// [Authorize]
public class PersonController : Controller
{

[Authorize]
public ActionResult Index()
{
……
}
[Authorize]
public ActionResult Add()
{
……
}

}

About the Author

avatar