gpt4 book ai didi

asp.net - 以 %20 结尾的 URL 出现问题

转载 作者:行者123 更新时间:2023-12-02 05:56:34 24 4
gpt4 key购买 nike

我有一个大问题。现场有设备发送 URL“/updates”。这是这些设备的开发人员的拼写错误。在服务器日志中,它看起来像“/updates+”。

我有一个 ManageURL 重写模块,可以处理所有没有扩展名的请求。但是这个请求会导致 HttpException:

System.Web.HttpException:

System.Web.HttpException
at System.Web.Util.FileUtil.CheckSuspiciousPhysicalPath(String physicalPath)
at System.Web.HttpContext.ValidatePath()
at System.Web.HttpApplication.ValidatePathExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

正如我在日志中看到的,URL 重写模块甚至没有获取此 URL,因此我无法在那里修复它。

有没有办法用 ASP.NET 处理这些 URL?

最佳答案

好吧,这是一个旧线程,但我想添加一个适用于所有 ASP.NET 版本的可行解决方案。看看this answer in a related thread 。基本上归结为注册事件 PreSendRequestHeadersglobal.asax.cs .

或者,在 ASP.NET 4.0 或更高版本上,使用 <httpRuntime relaxedUrlToFileSystemMapping="true" />在 web.config 中。

关于asp.net - 以 %20 结尾的 URL 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1126735/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com