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)

Syntax

'Declaration
Public Enumeration FilterScope
'Usage
Dim instance As FilterScope
public enum FilterScope
public enum class FilterScope
public enum FilterScope

Members

Member name Description
First Specifies first.
Global Specifies an order before Controller and after First.
Controller Specifies an order before Action and after Global.
Action Specifies an order before Last and after Controller.
Last Specifies last.

Remarks

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.

See Also

Reference

System.Web.Mvc Namespace