Generally, URL Routing/Rewiring is a URL pattern matching system that monitor the browser request and heck out what to do with that browser request. The Routing module is responsible for mapping incoming browser requests to particular ASP.NET MVC controller actions. We can to make very pretty URLs more flexible. We can create "Route Table" inside the application`s "Global.asax" file.
Routing system divided in two part:
- RouteData: This Technic is used to investigate an incoming URL and then check which controller and action the request is need to be send.
- VirtualPath: This Technic is responsible for generating Outbound URL. These are the URLs that appear in the HTML rendered from our views so that a specific action will be invoked when the user clicks the link
- //Default url
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- routes.MapRoute(
- "Default",
- "",
- new { controller = "Home", action = "Index", id = "" }
- );
- //others URL rewriting you want
- routes.MapRoute(null,
- "Search/{City_State}/{ID}",
- new { controller = "Home", action = "Search" }
- );

Deepak VermaPosted May 2, 2018, 7:27 AM
Nice blog................
Umesh ParshadPosted Apr 20, 2017, 12:06 AM
Very useful ...thanks for sharing
Santhakumar MunuswamyPosted Apr 30, 2015, 3:09 PM
Nice