Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Controllers attributes

Alexanderius edited this page Feb 14, 2016 · 5 revisions

All controllers attributes can be found in AcspNet.Attributes namespace.

Available controllers attributes:

  • [Get("route expression")] - attribute which indicates what controller handles only HTTP GET request with specified route expression;
  • [Post("route expression")] - attribute which indicates what controller handles only HTTP POST request with specified route expression;
  • [Delete("route expression")] - attribute which indicates what controller handles only HTTP DELETE request with specified route expression;
  • [Put("route expression")] - attribute which indicates what controller handles only HTTP PUT request with specified route expression.

Route expressions description

  • [Http400] - attribute which indicates what controller handles HTTP 400 errors (not implemented);

  • [Http403] - attribute which indicates what controller handles HTTP 403 errors (user is authenticated but does not have access rights);

  • [Http404] - attribute which indicates what controller handles HTTP 404 errors (page not found), for example, if user is calling page with specified route expression is not found, then controller with this attribute will be called.

  • [Priority(1)] - attribute which sets controller invoke priority, controllers will be sorted and invoked according to their priority number (controllers with lower number will be invoked before controllers with higher number), default controller priority is: 0.

  • [Authorize] - attribute which indicates what controller requires user to be authenticated, otherwise client will be redirected to login page;

  • [Authorize("Role1, Role2")] - authorize attribute with specifying user roles, only users with speicfied roles can access controller, otherwise HTTP 403 error will be returned (or controller with Http403 attribute will be called, if it is present).

<< Previous page Next page >>

Clone this wiki locally