通过检查我的elmah日志,我看到我不断收到“太长的url”请求。错误是:Asp.Net MVC:具有太长URL和错误处理请求
System.Web.HttpException (0x80004005): The length of the URL for this request exceeds the configured maxUrlLength value.
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
这里是那种要求,我收到:
/index.php/blog/post/the_ten_deceptions_of_the_datetimepicker/+[PLM=0]+GET+http:/www .visualhint.com/index.php的/博客/后/ the_ten_deceptions_of_the_datetimepicker/+ [0,23778,23037] + - > + [N] + POST HTTP +:/www.visualhint.com/index.php/blog/post/ the_ten_deceptions_of_the_datetimepicker/+ [0,0,2007]
(不要惊讶于php的事情......在成为一个asp.net mvc网站之前,我的网站当URL停在/index.php/blog/post/the_ten_deceptions_of_the_datetimepicker是PHP,现在我需要这种旧网址重定向到我新的URL格式,效果很好)
什么能产生这些要求?它听起来有恶意吗?
我有自定义错误设置,所以我虽然这样的请求将被重定向到我的自定义错误页面,但事实并非如此。相反,人们会得到典型的黄色屏幕(萤火虫提到这是一个400坏请求)。如果你看看上面的堆栈跟踪,它非常短,异常似乎很早被捕获(Application_BeginRequest甚至没有被调用)。是否有可能显示我的自定义错误页面,或者我能否至少在发生这种异常时重定向到我的主页?
我尝试添加错误400线在我的web.config:
<customErrors mode="RemoteOnly">
<error statusCode="400" redirect="/" />
</customErrors>
这重定向到网页的权利,但它增加了完整的URL在aspxerrorpath查询字符串值。
感谢您的帮助。
这里的建议可能有帮助:http://stackoverflow.com/questions/1185739/asp-net-mvc-url-routing-maximum-path-url-length –