■ CONTENTS
xix
■Chapter 19: Filters ............................................................................................. 581
Preparing the Example Project ..................................................................................... 582
Enabling SSL .......................................................................................................................................583
Creating the Controller and View ........................................................................................................584
Using Filters ................................................................................................................. 586
Understanding Filters ................................................................................................... 589
Getting Context Data ...........................................................................................................................589
Using Authorization Filters ........................................................................................... 590
Creating an Authorization Filter ..........................................................................................................591
Using Action Filters ...................................................................................................... 593
Creating an Action Filter .....................................................................................................................595
Creating an Asynchronous Action Filter ..............................................................................................597
Using Result Filters ...................................................................................................... 598
Creating a Result Filter .......................................................................................................................599
Creating an Asynchronous Result Filter ..............................................................................................600
Creating a Hybrid Action/Result Filter .................................................................................................602
Using Exception Filters ................................................................................................. 604
Creating an Exception Filter ...............................................................................................................605
Using Dependency Injection for Filters ......................................................................... 607
Resolving Filter Dependencies ...........................................................................................................607
Managing Filter Life Cycles ................................................................................................................611
Creating Global Filters .................................................................................................. 614
Understanding and Changing Filter Order .................................................................... 617
Changing Filter Order .........................................................................................................................619
Summary ...................................................................................................................... 620
■Chapter 20: API Controllers ............................................................................... 621
Preparing the Example Project ..................................................................................... 622
Creating the Model and Repository ....................................................................................................622
Creating the Controller and Views ......................................................................................................624
Confi guring the Application ................................................................................................................626