Skip to content

How to configure routing

marektihkan edited this page Sep 13, 2010 · 1 revision

Workflow

  1. Create class (Routes) to Solution.Configuration.Routing namespace.
  2. Inherit from Arc.Infrastructure.Presentation.Mvc.RoutesConfiguration.
  3. Implement interface and add your routes.
  4. Add Arc.Infrastructure.Presentation.Mvc.PresentationConfiguration.WithRouting<Routes>() to application configuration.

Remarks

  • It’s possible to configure routes ASP.NET MVC way as well.

Example


namespace Example.Configuration.Routes
{
    public class Routes : Arc.Infrastructure.Presentation.Mvc.RoutesConfiguration
    {
        protected override void Configure()
        {
            Ignore(
                Route.Named("Resources").Url("{resource}.axd/{*pathInfo}")    
            );

            Map(
                Route.Named("Default")
                    .Url("{controller}/{action}/{id}")
                    .DefaultsAre(new { controller = "Home", action = "Index", id = "" })
            );
        }
    }
}