tags:

views:

88

answers:

3

Hi All,

**UPDATED**

I have a custom ContentActionInvoker that has some crazy logic in it.

I'd like in some case to invoke a different action in a diffrent controller and with some different parameters.

How can this be done?

class ContentActionInvoker : ControllerActionInvoker
{
        protected override ActionResult InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary<string, object> parameters)
        {
           ....
        }
}
A: 

Don't you want to use RedirectToAction("MyAction")?

Kezzer
Dang, missed by less than a minute. :)
griegs
And I'm at work too, being busy answering questions on SO of course ;)
Kezzer
hehe, nice. I'm home with little else to do.
griegs
I've might been missing something, but I have now method called RedirectToAction. I'm not in a action, and this should happen before I have a action.
CD
@CD: Just update your question to reflect these details you've just given. Tell us exactly where you're wanting to do this from your MVC application. Typically you want to do redirects from controller actions. If it's not from an action then there might be something more that needs doing.
Kezzer
A: 

Have you tried RedirectToAction or am I off base?

griegs
+1  A: 

Why do you need to redirect the user's experience back through the webserver (forcing the browser to make a round-trip) to access another class that is operating in the same AppDomain as the code that received the request from the MvcHandler?

If you want process data in another method, with different parameters, just instantiate that other class (or controller, which is just another class...) and either return the ActionResult generated by THOSE methods, or reformat your own ActionResult for the View requested.

Jeff Fritz
Thanks Jeff, that's what I'd like to do, how can I do it? can you refer any code examples?
CD