#62 Action Filters-Authorization

Authorize Attribute is used to restrict the controller/Action with respect to Users.

Authorize Attribute-takes Roles,Users,Order as parameters

/*Authorize users whose role is admin*/
[Authorize(Roles = "admin")] 
<span style="font-style: inherit; font-weight: inherit; line-height: 1.625;">public ActionResult Index()</span>
 return Content("Hello");

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s