how to add default parameters to attribute routes in asp.net mvc
I am trying to change this convention based route: routes.MapRoute( "MovieByReleaseDate", "movies/released/{year}/{month}", new { controller = "Movies", action = "ByReleasedDate" }, ); to attribute route: [Route("movies/released/{year}/{month}")] but I can't see how I can define default parameters like in the first way. Steve Perkins You can use multiple [Route] attributes coupled with nullable parameters to achieve your goal. [HttpGet] [Route("movies/released/")] [Route("movies/released/{year}")] [Route("movies/released/{year}/{month}")] public string Test(int? year = 2018, int? month = 1) {