Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Custom Action Filters in ASP.NET MVC

Custom Action Filters in ASP.NET MVC

Avatar for Tonya Cooper

Tonya Cooper

July 02, 2022
Tweet

More Decks by Tonya Cooper

Other Decks in Technology

Transcript

  1. What are action filters? An attribute that can be applied

    to an individual action method on a controller, or to the entire controller.
  2. Custom Filters • Share code across action methods • Share

    code across controllers • Custom exception handling • Logging • Modify responses • Save responses
  3. Start Filtering 1. Name your filters appropriately 2. Apply to

    one or more action 3. Apply to one or more controller
  4. Start Filtering 1. Name your filters appropriately 2. Apply to

    one or more action 3. Apply to one or more controller 4. Apply globally
  5. Start Filtering 1. Name your filters appropriately 2. Apply to

    one or more action 3. Apply to one or more controller 4. Apply globally 5. Specify the order