Search code examples
c#asp.net-mvcasp.net-mvc-2action-filter

MVC 2 post-render extensibility point (custom action filters, even?)


I've got an .net MVC2 project, and I can't find a method to override which will allow me to perform some logic following a page render...

I'm currently using the OnActionExecuted / OnActionExecuting (and the OnResultExecuting / OnResultExecuted in my controllers to do a variety of things, the important one here being to place some objects onto thread local storage(TLS) - current user, for example.

As such, I do the 'setup' of the TLS in the OnActionExecuting, but I can't do the 'teardown' until after the page has been rendered.

Any suggestions? I don't want to leave parts of the TLS setup.

specifically, my view is calling a property of an object which needs to access TLS before I tear it down.

Thanks, Dave


Solution

  • I ended up overriding the 'OnResultExecuted' method.