In MVC you can add custom route for example if i have an Controller and ActionResult like below
public class HelloController : Controller
{
public ActionResult Index()
{
return View();
}
If you want to display the routes as
http://localhost:56007/25-virtual-gift-card[
^] whenever you browse http://localhost:56007/hello/index You should add custom route like below
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"SecondRoute",
"25-virtual-gift-card",
new { controller = "Hello", action = "Index" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Hello", action = "Index", id = UrlParameter.Optional }
);
}
For more custom routes about
http://www.asp.net/mvc/tutorials/controllers-and-routing/creating-custom-routes-cs[
^]
Hope this helps