In my controller I have an HTTP get method that accepts a string
[HttpGet("{token}"]
public async Task<IActionResult> GetFoo(string token)
{
//Some actine
return Ok(object);
}
If I send the below-encoded token test%2Atest
, ASP .NET will decode this token to test*test
by default. But if I send test%2Ftest
, it does not decode the %2F
to /
.
I can understand why ASP.NET doesn't do that as it breaks the routes.
Is there a way to disable this default behavior so I can de the decoding in my controller?
I could not find a way to disable default URL decoding in ASP.net core.
As Tiny Wang suggested above, I changed the application to send the token in the header and that fixed the problem.