Reputation: 27107
Is it possible to intercept requests in the ASP.NET MVC Framework (beta 1) in order to interact and inspect them?
I need to attach some logging and in some cases dynamically work out if the URL needs authorizing (like applying the Authorize attribute - but at run-time).
Upvotes: 4
Views: 1558
Reputation: 59001
Filters in MVC are applied at compile time, but executed at runtime. You could implement a custom auth filter that would inspect the URL and selectively authorize. It would probably help if you provided more specifics of the scenario you're trying to accomplish.
Upvotes: 1
Reputation: 40951
Standard HttpModules work just fine.
You can also choose to add your own custom IRouteHandler, and specifically register routes with that (or hijack the current route definitions and replace them with your route handler).
This should give you the flexibility you need.
Upvotes: 2