I\'m new in asp and I created a login page for my web project but and I set authentication but I can not set authorization for my project! I saw many links like this Authenticat
If you want authorization on your whole controller, just set the Authorize attribute on your controller:
[Authorize]
public class AuthenticationController : Controller
{
}
If you want authorization on a sigle action:
public class AuthenticationController : Controller
{
[Authorize]
public ActionResult Index()
{
ViewBag.Message = "Welcome, " + HttpContext.User.Identity.Name;
}
}
EDIT: Only authenticated users will be able to navigate through authorized methods or controllers