RedirectToAction method calls to controller in shared library

Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.

Commented on
Hey Max. From some of my earlier posts you saw that I keep shared controllers in a separate project that gets referenced from various MVC web apps.

I would like to be able to redirect certain incoming requests from the MVC controller to be handled by the shared controller instead. I assume RedirectToAction is the proper method to do this? However I am unsure of the parms to be passed. Everything I have tried so far fails with an error "No route in the route table matches the supplied values. ".

Here is the routes.axd output for the controller action I am trying to pass into RedirectToAction...
routes.MapRoute(null, "shared/controller/application", 
    new { controller = "Controller", action = "Application" }, 
    new[] { "SharedProject.Controllers.Shared" });
Thanks in advance,
Wade
Commented on link
When you register the shared controllers, are you using a base route?
Commented on link
Yes, I actually register two base route.
1) DefaultController is in the MVC web app
            routes.MapCodeRoutes(
                rootController: typeof(DefaultController)
                , settings: new CodeRoutingSettings { 
                    EnableEmbeddedViews = true
                    , RouteFormatter = args => args.OriginalSegment.ToLowerInvariant()
                }
            );
2) DirectoryController is at the root of the SharedProject controllers folder
            routes.MapCodeRoutes(
                rootController: typeof(SharedProject.Controllers.DirectoryController)
                , settings: new CodeRoutingSettings {
                    EnableEmbeddedViews = true
                    , RouteFormatter = args => args.OriginalSegment.ToLowerInvariant()
                }
            );
Commented on link
The code you are showing me is not using base route.

I think this should work:
return RedirectToAction("Application", "~~Shared.Controller");
Commented on link
Ok, I guess I don't understand what a base route is. Nevertheless what you sent me works so I am good to go... Thanks!
Commented on link
The MapCodeRoutes method has an overload with three parameters, the first one is the base route.