ASP .NET MVC Secure all resources
Posted
by Tim
on Stack Overflow
See other posts from Stack Overflow
or by Tim
Published on 2010-04-01T07:02:11Z
Indexed on
2010/04/01
7:33 UTC
Read the original article
Hit count: 237
c#
|asp.net-mvc
How to enable Authentication on whole controller and disable only for certain action methods. I want authentication for all resources. If I write something like that:
[Authorize]
public class HomeController : BaseController
{
//This is public
[UnAuthorized]
public ActionResult Index()
{
ViewData["Message"] = "Welcome to ASP.NET MVC!";
return View();
}
//This is private resource
public ActionResult PrivateResource()
{
return View();
}
}
Then anyone can access this resource. Do you have any ideas how to make it better way?
© Stack Overflow or respective owner