views:

29

answers:

1

Hi folks,

I replaced the ASP.NET ControllerFactory by a WindsorControllerFactory.

And I registered all controllers and interceptors. Until here everything working well.

Now when I am debuging my Interceptor I always get Execute from ControllerBase in invocation.Method.Name. I need to get the action name and the parameters of the action to do some validations.

How can I get the action name and the action parameters in the Intercept method of my Interceptor? The information of ControllerBase_Execute method and his parameters don't help me.

Thanks,

Raphael Molesim

+1  A: 

I believe you can get that from the RequestContext.RouteData collection. I think the keys for the method/action is "action". Something like:

requestContext.RouteData.Values["action"]
Patrick Steele
Nice! It works. But I'm not really happy with this. I would like intercepting the real action. Now I will need to render a error, in my interceptor method, How can I do that? If I have the real controller I would do something like controller.ModelState.AddModelError() and after I could do some View(model).Thanks,Raphael Molesim
Not sure I understand exactly. Could you provide some sample code of your interceptor -- how its integrated in ControllerBase.Execute, what it's doing and what you'd like it to do?
Patrick Steele