Html.ActionLink and default controller

Dec 23, 2015 at 6:45 AM
Edited Dec 23, 2015 at 6:46 AM

Thank you for the nice library.

I've a simple website with some controllers and views. I've setup MvcCodeRouting via:
/routes.axd gives the following:
// MvcCodeRouting v1.3.0
// Format: C# - Visual Basic 
routes.MapRoute(null, "Login", new { controller = "Users", action = "Login" }); 
routes.MapRoute(null, "Request", new { controller = "Users", action = "RequestAccess" });
#region (root) 
  new { controller = "Home", action = "Index" }, 
  new { action = new SetRouteConstraint("Index", "Test") }, 
  new[] { "....Controllers" }

  new { controller = "Users", action = "ConfirmRequest" }, 
  new[] { ".....Controllers" }
As I understand it is by design that the default controllers (Home in this case) actions are mapped without the controller name.

My question how do I use Html.ActionLink in a view from another controller to get a link to HomeControllers Index action? At the moment Html.ActionLink("home", "Index", "Home") generates an empty link. I assume this is because the method can not find any route?

With best regards,
Josha Munnik
Dec 23, 2015 at 2:21 PM
Dec 23, 2015 at 3:19 PM
Thanks for the quick reply. I did not read it before, but the text did not offer much more help.

However everything is working now; no idea what went wrong before but I'm happy I can keep using this library; it make things much more logical and simple in use :)

Happy holidays and a good 2016