Confused - using Url.Action inside AreaRegistration.cs file

I have a following route specified. This route and all others point to an intermediate action that in turn then redirects to the redirectUrl. I need help with using Url.Action inside my area registration file, can’t seem to find any reference to assembly that i need to include inside the area registration.


context.MapRoute(
                    "OPHR", // Route name
                    "OPHR/{purl}", // URL with parameters
                    new
                    {
                        controller = ControllerNames.Home,
                        action = ActionNames.PageRedirector,
                        Area = AreaNames.Redirector,
                        groupId = "TS0809R",
                        redirectUrl =  "/" + AreaNames.Mailings + "/" + ControllerNames.Editions + "/" + ActionNames.Reach,
                        campaignId = "TS0809R"
                    },
                    new string[] { "Company.Site.Areas.Redirector.Controllers" }
            );

Thanks

Using GenerateUrl, what should i pass for requestContext (last empty string before true)?


 redirectUrl =  UrlHelper.GenerateUrl("", ActionNames.HonorsReach, ControllerNames.OutreachEditions, 
                                                            new RouteValueDictionary(new { Area = AreaNames.Mailings }),
                                                            RouteTable.Routes, "", true)

I don’t think this will work even if you manage to get past the syntax issues – your routes might not be reigstered when calling this.

What you are better off doing is setting up all the redirectors to hit the same controller which can then lookup where to send folks (on or offsite; trust me; you’ll want offsite at some point).

Thanks wwb_99, i had implemented the links pointing to cms section exactly as you have specified. These other, just wanted to do and test differently. Reverted back to original approach.