FilterScope Enumeration

Defines values that specify the order in which ASP.NET MVC filters run within the same filter type and filter order.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Public Enumeration FilterScope
Dim instance As FilterScope

Member nameDescription
FirstSpecifies first.
GlobalSpecifies an order before Controller and after First.
ControllerSpecifies an order before Action and after Global.
ActionSpecifies an order before Last and after Controller.
LastSpecifies last.

The ASP.NET MVC framework supports the following types of filters:

  1. Authorization filters, which implement the IAuthorizationFilter interface.

  2. Action filters, which implement the IActionFilter interface.

  3. Response filters, which implement the IResultFilter interface.

  4. Exception filters, which implement the IExceptionFilter interface.

Filters run in the order listed — for example, authorization filters run first and exception filters run last. Within each filter type, the Order value specifies the run order. Within each filter type and order, the Scope value specifies the order for filters. This enumeration defines the following filter scope values (in the order in which they run):

  1. First

  2. Global

  3. Controller

  4. Action

  5. Last

For example, an action filter that has the Order property set to zero and filter scope set to First runs before an action filter that has the Order property set to zero and filter scope set to Action.

The execution order of filters that have the same type, order and scope is undefined.