ASP.NET Core MVC: Problem with routing argument that contains %2F (forward slash)

Viewed 1528

I have the following routing attribute in place:

[HttpGet("{id}/foo")]

My id is a base64 encoded value, and, as such, may contain a forward slash. I'm encoding this forward slash using %2F, however, it seems like ASP.NET Core MVC decodes the URL, then matches routes, as I'm getting a 404 if my id contains %2F.

Is there any way I can allow %2F in my id?

I know there are some answers out there (e.g. How to match web api 2 route with forward slashes in request parameters?), but with all of them, the parameter in question, is always the last, and only then you can use a wildcard (?).

0 Answers
Related