Sen*_*der 8 iis .net-core asp.net-core-webapi
我在dotnet核心中处理web API项目并检查用户手机号码是否存在.
[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));
}
}
Run Code Online (Sandbox Code Playgroud)
请求网址:
当我用加号请求上面的URL时,它给出了一个错误.
相同的网址没有+符号它工作正常.
我尝试使用带有%2B的编码+符号,但它不起作用
我如何申请加号?
这是一个IIS问题:
请看以下帖子:
url中的双转义序列:请求过滤模块配置为拒绝包含双转义序列的请求
如果您尝试使用Kestrel运行您的应用程序,您将看到它的工作原理.对于IIS,您需要在web.config中添加以下部分:
<system.webServer>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1514 次 |
| 最近记录: |