What are ASP.NET MVC Filters and Attributes?

ASP.NET MVC provides a simple way to inject your piece of code or logic either before or after an action is executed. This is achieved by decorating the controllers or actions with ASP.NET MVC attributes or custom attributes. An attribute or custom attribute implements the ASP.NET MVC filters (filter interface) and can contain your piece of code or logic. You can make your own custom filters or attributes either by implementing ASP.NET MVC filter interface or by inheriting and overriding methods of ASP.NET MVC filter attribute class if available.
Typically, Filters are used to perform the following common functionalities in your ASP.NET MVC application.

  1. Custom Authentication
  2. Custom Authorization (User based or Role based)
  3. Error handling or logging
  4. User Activity Logging
  5. Data Caching
  6. Data Compression
Tagged , . Bookmark the permalink.

One Response to What are ASP.NET MVC Filters and Attributes?

  1. Ganesh Mandlik says:

    Hello Sir,
    Thank you very much!!!!!
    Nice explanation!!!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *