using System.Web.Mvc;
using System.Web.Routing;
namespace CustomRouteMakale
{
public class MvcApplication : System.Web.HttpApplication
public static void RegisterRoutes(RouteCollection routes)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Blog", // Route name
"Archive/{entryDate}", // URL with parameters
new { controller = "Archive", action = "Entry" } // Parameter defaults
);
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
}
protected void Application_Start()
RegisterRoutes(RouteTable.Routes);
public class ArchiveController : Controller
public string Entry(DateTime entryDate)
return "You requested the entry from " + entryDate.ToString();