AttributeAuthorizeused to indicate restrictions on access to the controller or method of action. In other words, you can grant or deny users / roles access to certain pages or URLs on the site.
ASP.NET, .
- PrincipalPermission. PrincipalPermission . , -.
.
using System;
using System.Security.Permissions;
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
public class EmployeeManager
{
[PrincipalPermission(SecurityAction.Demand, Role = "Manager")]
public Employee LookupEmployee(int employeeID)
{
}
[PrincipalPermission(SecurityAction.Demand, Role = "HR")]
public void AddEmployee(Employee e)
{
}
}
, PrincipalPermission,
EmployeeManager .LookupEmployee Manager.
ASP.NET 2.0