aspnet / Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
5.62k stars 2.14k forks source link

HTTP 415 when query string contains '-' #8776

Closed hez2010 closed 5 years ago

hez2010 commented 5 years ago

Is this a Bug or Feature request?:

Bug

Steps to reproduce (preferably a link to a GitHub repo with a repro project):

dotnet new mvc

Create a controller and a method, such as

class HomeController
{
    public string Test(string param)
    {
        return "ok";
    }
}

and SetCompatibilityVersion to version_2_1 and then access this method in js using (query string parameter value contains '-')

fetch('/Home/Test?param=123-456-789');

Description of the problem:

In ASP.NET Core 2.1, it works and Test was invoked with param="123-456-789". But in ASP.NET Core 2.2, it will return HTTP 415 without invoking the method.

Version of Microsoft.AspNetCore.Mvc or Microsoft.AspNetCore.App or Microsoft.AspNetCore.All:

Microsoft.AspNetCore.App: 2.2.0