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

public enum FilterScope
public enum class FilterScope
type FilterScope
Public Enumeration FilterScope

Members

Member name Description
Action

Specifies an order before Last and after Controller.

Controller

Specifies an order before Action and after Global.

First

Specifies first.

Global

Specifies an order before Controller and after First.

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

System.Web.Mvc Namespace

Return to top