11

I work on web API project in the dotnet core and check user mobile number exists check.

[Route("api/[controller]")]
public class UserController : Controller
{
    [HttpGet]
    [Route("mobile/exist/{mobile}/{id:int?}")]
    public async Task<IActionResult> MobileExist(string mobile, int? id)
    {
        return Json(await _userService.MobileExist(mobile, id));
    }
}

Request URL:

http://localhost:3364/api/user/mobile/exist/+123456

When I request above URL with the plus sign it given an error.

The Same URL without + sign it's working good.

I try with encoded + sign with %2B but it not working

How can I request with plus sign?

Avi K.
  • 1,734
  • 2
  • 18
  • 28
Sender
  • 6,660
  • 12
  • 47
  • 66

1 Answers1

14

This is an IIS issue:

Please look at the following post:

double escape sequence inside a url : The request filtering module is configured to deny a request that contains a double escape sequence

If you try to run your app with Kestrel, you will see that it works. For IIS, you will need to add the following section in you web.config:

<system.webServer>
  <security>
    <requestFiltering allowDoubleEscaping="true" />
  </security>
</system.webServer>
Community
  • 1
  • 1
Avi K.
  • 1,734
  • 2
  • 18
  • 28