Url.Action is returning null

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.
<ol>
    <li>@Url.Action("LogOut", "~~Authentication.Account")</li>
    <li>@Url.Action("LogOut", "~Authentication.Account")</li>
    <li>@Url.Action("LogOut", "Authentication.Account")</li>
    <li>@Url.Action("LogOut", "Account")</li>
</ol>

<ol>
    <li>@Html.ActionLink("Test LogIn", "LogIn", "~~Authentication.Account")</li>
    <li>@Html.ActionLink("Test LogIn", "LogIn", "~Authentication.Account")</li>
    <li>@Html.ActionLink("Test LogIn", "LogIn", "Authentication.Account")</li>
    <li>@Html.ActionLink("Test LogIn", "LogIn", "Account")</li>
</ol>
Commented on link
This could happen if the current route was not created by MvcCodeRouting, in this case the HomeController. Is that the case here?
Commented on link
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.
Commented on link
I just noticed, the routes show LogOn|LogOff, but the view uses LogIn/LogOut :-)
Commented on link
I hate it when that happens. :)
After getting a good night of sleep, I noticed the same thing.
Thanks.