NikolaiDante
NikolaiDante

Reputation: 18639

ActionFilterAttribute - Event Order

On a controller method annotated ActionFilterAttribute which happens first, the OnActionExecuting or the OnResulting methods?

What is the order that things happen? I've read the MSDN page but it isn't clear to me.

Upvotes: 4

Views: 3147

Answers (2)

ten5peed
ten5peed

Reputation: 15890

It should be the following order:

  1. OnActionExecuting
  2. OnActionExecuted
  3. OnResultExcuting
  4. OnResultExecuted

Upvotes: 2

Filip W
Filip W

Reputation: 27187

It's all on MSDN - http://msdn.microsoft.com/en-us/library/gg416513(v=vs.98).aspx

  1. OnAuthorization - run before anything, to make security decisions
  2. OnActionExecuting – called when a controller action is executed
  3. OnActionExecuted – called after a controller action is executed
  4. OnResultExecuting – called before a controller action result is executed
  5. OnResultExecuted – called after a controller action result is executed

Exception filters (OnException) run when errors occur

Upvotes: 13

Related Questions