0

How to hide Controller name, action name and show only passed parameters using Routing in MVC for example Url is http://www.test.com/pages/Pages/?pageURL=Returns

I want Url just :- http://www.test.com/Returns

pageURL=Returns is dynamical parameter value

thank you.

1 Answers1

0

Try this:

private void RegisterRoutes(RouteCollection routes) {

  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

  routes.MapRoute("default", "{controller}/{action}/{id}",
     new { action = "index", id = "" },
     // Register below the name of all the other controllers
     new { controller = @"^(account|support)$" });

  routes.MapRoute("home", "{action}",
     new { controller = "device", action = "index" });
}

Source: How do I configure ASP.NET MVC routing to hide the controller name on a "home" page?

Community
  • 1
  • 1
Syed Ali Taqi
  • 4,898
  • 3
  • 34
  • 44