Using Filter

Filters are things you can do before or after the actual executable actions.

The order of filter goes like this,

IAuthenticationFilter > IAuthorizationFilter > iActionFilter > IResultFilter

and if during Action, exception occur then IExceptionFilter

You can set filter at web.config or by having bracket at the top of classes.

IExceptionFilter

One of the main attribute in IExceptionFilter is HandleError Attribute.  Here we want to tell the system what we want do when exception occurs.  (we want to tell what to do when an error happens.)

Custom Errors

You can do display error  page with detail message, with out much of message,  or redirect to custom page when the error occurs.

Usually you will choose RemoteOnly option, which is to display detail error message at local environment and hide detail error message at online environment.

I will cover about handling error more later.  I just let you know IExceptionFilter is here.

Handling Cache

You can specify how to use cache by having [OoutputCache(duration=240)] at the head of classes.  Or at Web.Config

You have create profile at Web.Config then you can use them like

When using partial views, you can specify cache rules to partial view only or both partial and main view.

Controller

View

 

and more to be continued.

Leave a Reply