I'm trying to remove 'home' form my URL, so in other words:
www.domain.com/home/about/ becomes www.domain.com/aboutus
The problem is, the home is not being removed and I can't work out why. I can see others have identical questions with near identical answers as to mine here on on SO so I am at a loss why this won't work.
My Global.asax is
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace Company.Ui
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("RemoveHomeUrl", // Route name
"{action}", // URL with parameters
new { controller = "Home", action = "Index" } // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
}
}
My ActionLink code is:
@Html.ActionLink("About us", "AboutUs", "Home", null, new { @class = "mega" })
When I hover over a link and when I click on the link, it still returns www.domain.com\home\aboutus
I'm running this in debug mode in Visual Studio 2012.
I am at a loss, can any one help?