Following is the code in Home Controller :
public ActionResult Index()
{
return View();
}
public ActionResult AboutUs()
{
return View();
}
Following is code in my RouteConfig.cs
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"AboutUsPage",
"about",
new { Controller = "Home", action = "AboutUs", });
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Now If I hit the address "localhost:9731/Home/AboutUs" then It will Hit my AboutUs action in Home Controller. similarly If I hit the address "localhost:9731/about" then It will Hit my AboutUs action in Home Controller beacuse of URL rewriting in RouteConfig.cs.
Question is that How to display "localhost:9731/about" when User hit "localhost:9731/Home/AboutUs" in address bar??. Please help me. Thanks.