How do I get certain code to execute before every single controller action in ASP.NET MVC 2?
- by Chris
I want to check some things about the state of the session, the user agent, etc, and possibly take action and return a special view BEFORE a controller method gets a chance to execute. For example:
Most common:
User requests Home/Index
System checks to make sure x != 0.
x does not equal zero, so the Home/Index controller executes like normal.
…