如何编码查询字符串空间%20而不是+?因为System.Web HttpUtility.UrlEncode()给了空间+.
我在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的编码+符号,但它不起作用
我如何申请加号?
我收到 HTTP错误 404.11 - 未找到请求过滤模块配置为拒绝包含双转义序列的请求。 当我向 Blazor 中的 .razor 页面发送请求时出错,链接是动态构建的并发送到用户电子邮件:
string confirmationLink = $"{HttpContext.Request.Scheme}://{Request.Host}/account/confirmemail/{System.Web.HttpUtility.UrlEncode(user.Id)}/{System.Web.HttpUtility.UrlEncode(confirmationToken)}";
Run Code Online (Sandbox Code Playgroud)
我在五个地方修改了 IIS Express 配置文件:
在所有情况下,我都修改了
<requestFiltering allowDoubleEscaping="true">
Run Code Online (Sandbox Code Playgroud)
“web.server”“安全”部分中的标记。但我仍然收到错误。有什么解决办法吗?