Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.
Commented on
What is required to get the various extension methods (URL.Action, Html.ActionLink, etc..) to return a proper URL? Seems that no matter what I pass to these methods, it won't match any routes. I don't get any exception, I just get an null or empty href (depending on the exact method used).
Here's a brief description of the issue in my environment (cut down to show just 1 controller).
I've got the following controller defined...
/Controllers/Authentication/AccountController
with two actions...
LogOn
LogOff
/Routes.axd shows...
routes.MapRoute(null, "Authentication/Account/{action}",
new { controller = @"Account" },
new { action = @"LogOn|LogOff" },
new[] { "MyCompany.WebApp.Controllers.Authentication" });
I can manually navigate to /Authentication/Account/LogOn & /Authentication/Account/LogOff and both actions return the expected view.
However, if I put something like the code below into my Home/Index.cshtml page, every single one of the Url.Action calls returns null and the Html.ActionLink calls render an A tag with an empty href attribute.
No, all routes are created using the default MvcCodeRouting options. I did not manually create any routes, and the index action on the home controller does show up in the routes.axd output.