-
Notifications
You must be signed in to change notification settings - Fork 17
Route registration
AlexBar edited this page Apr 14, 2012
·
1 revision
To register routes you need to inherit your class from abstract class RegisterRoutesBase:
public class RegisterRoutes : RegisterRoutesBase
{
public RegisterRoutes(RouteCollection routes) : base(routes)
{
}
protected override void Register()
{
Routes.IgnoreRoute("favicon.ico");
Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
Routes.MapRoute("Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
}
And then you have to add the task to the bootstrapper:
//Global.asax.cs
public class MvcApplication : MvcExtensions.WindsorMvcApplication
{
public MvcApplication()
{
Bootstrapper.BootstrapperTasks
.Include<RegisterRoutes>();
}
}