Skip to content

Routes with defaulted querystring constraints do not match when querystring parameter is missing #270

@brantb

Description

@brantb

Given an action method with a route defined as below, the URL /Index does not match any route.

public class HomeController : Controller
{
    [GET("Index?{page=1}")]
    public ActionResult Index(int page)
    {
        return View("Index", page);
    }
}

I expected that a URL like /Index would match this route and default the page routedata value to 1, but it does not.

When I actually specify a page querystring value (like /Index?page=4) it works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions