This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Default for catchall segment doesn't work #2931
Closed
Description
[Route("Foo/{*path}")]
public ActionResult Foo(string path = "default")
{
if (path == null)
{
return Content("NULL");
}
if (string.IsNullOrEmpty(path))
{
return Content("EMPTY");
}
return Content("Path: " + path);
}
If you hit /Foo/
on ASP.NET MVC 5, it outputs "Path: default". However, ASP.NET 5 + MVC 6 outputs "NULL". Hitting /Foo/Bar
correctly displays "Path: Bar" on both versions. This is the same if you change the default to an empty string - ASP.NET MVC 5 returns "EMPTY" whereas MVC 6 returns "NULL".
I also tried [Route("Foo/{*path=default}")]
which did not work either.
Wasn't sure whether to report this in the Routing repo or here; I've reported it here since I think catchall segments are an MVC thing (and also RouteAttribute
is an MVC thing)