问题与%20结尾的网址 [英] Problem with a URL that ends with %20

查看:108
本文介绍了问题与%20结尾的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的问题。有活的发送URL/更新的设备。这是开发商为这些设备的错字。在服务器的日志,它看起来像/更新+。

I have a big problem. There are devices in live that send the URL "/updates ". It's a typo of the developer for those devices. In the server logs, it looks like "/updates+".

我有处理所有请求,而不扩展ManageURL重写模块。但这一要求导致HttpException:

I have a ManageURL rewriting module that handles all requests without extension. But this request causes an 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,所以我不能修复它。

As I see in the logs, the URL rewriting module does not even get this URL, so I cannot fix it there.

有没有办法来处理与ASP.NET的网址吗?

Is there a way to handle those URLs with ASP.NET?

推荐答案

好吧,这是一个古老的线程,但我想补充的是,所有的ASP.NET版本工作的可行的解决方案。看一看<一个href=\"http://stackoverflow.com/questions/429963/the-resource-cannot-be-found-error-when-there-is-a-dot-at-the-end-of-the-url/5272936#5272936\">this回答一个相关的线程。它基本上可以归结为在的global.asax.cs 注册事件 preSendRequestHeaders

Ok, this is an old thread, but I like to add a workable solution that works for all ASP.NET versions. Have a look at this answer in a related thread. It basically comes down to registering to the event PreSendRequestHeaders in global.asax.cs.

另外,当在ASP.NET 4.0或更高版本,可以使用&LT;的httpRuntime relaxedUrlToFileSystemMapping =真/方式&gt; 在web.config中

Alternatively, when on ASP.NET 4.0 or higher, use <httpRuntime relaxedUrlToFileSystemMapping="true" /> in web.config.

这篇关于问题与%20结尾的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆