Gets or sets the user roles that are authorized to access the controller or action method.
System.Web.Mvc (in System.Web.Mvc.dll)
member Roles : string with get, set
The user roles that are authorized to access the controller or action method.
User roles are used to check authorization in an ASP.NET MVC application. A role defines privileges that are available to users who are assigned to that role. Users can belong to more than one role.
Return to top
The following example shows how to specify that a controller is only available to users in the Administrators roles.
public class AdminController : Controller
. . .