FilterAttribute Class
Represents the base class for action and result filter attributes.
System.Attribute
System.Web.Mvc.FilterAttribute
System.Web.Mvc.ActionFilterAttribute
System.Web.Mvc.AuthorizeAttribute
System.Web.Mvc.ChildActionOnlyAttribute
System.Web.Mvc.HandleErrorAttribute
System.Web.Mvc.RequireHttpsAttribute
System.Web.Mvc.ValidateAntiForgeryTokenAttribute
System.Web.Mvc.ValidateInputAttribute
Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
The FilterAttribute type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | AllowMultiple | Gets or sets a value that indicates whether more than one instance of the filter attribute can be specified. |
![]() | Order | Gets or sets the order in which the action filters are executed. |
![]() | TypeId | (Inherited from Attribute.) |
| Name | Description | |
|---|---|---|
![]() | Equals | (Inherited from Attribute.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Attribute.) |
![]() | GetType | (Inherited from Object.) |
![]() | IsDefaultAttribute | (Inherited from Attribute.) |
![]() | Match | (Inherited from Attribute.) |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
Typically, you create a filter by creating an attribute class that inherits from the abstract FilterAttribute class. Some built-in action filters, such as AuthorizeAttribute and HandleErrorAttribute, inherit from the FilterAttribute class. Other action filters, such as OutputCacheAttribute, inherit from the abstract ActionFilterAttribute class, which enables the action filter to run either before or after the action method runs.
You can use filter attributes to mark any action method or controller. If the attribute marks a controller, the filter applies to all action methods in that controller.
For more information about how to use attributes, see Extending Metadata Using Attributes.




