MVC .NET URL 不使用 RouteCollection 进行路由
我们使用 MVC .NET 和 RouteCollection 类在 Web 应用程序中路由 URL。此功能正常直到我们传递一个包含 URL 内任何位置的文本“PRN”的 URL。发生这种情况时,路由将不会发生,并向客户端返回 400 Page Not Found 错误。这就像在咨询路由集合之前就抛出了错误,因为 URL 应该采用的路由永远不会被触及(我的意思是底层代码的断点永远不会被击中,尽管没有字符串“PRN”的完全相同的 URL “将达到断点)。
所以我认为这可能是一个页面验证问题,也许微软决定在 URL 包含短语“PRN”时抛出异常,因为它就像“打印”或“色情”,但如果是这种情况,那么我们会看到“从客户端检测到潜在危险的 Request.Form 值”错误,但我们没有这样做。
研究这个问题很麻烦,因为 Google 认为 PRN 应该返回“色情”结果,这意味着我 98% 的搜索结果是无效的(并且不合适)。在 Google 中使用“-porn”子句会使您的结果下降到大约 10-30 次点击,毫无用处。
有谁知道为什么包含字符串“PRN”的 URL 无法正确路由?如果你有任何帖子或线索可以指出我,那就太好了(谷歌再次让我失望了)。
We're using MVC .NET and the RouteCollection class to route URLs in our web app. This functions normally until we pass a URL containing the the text "PRN" anywhere inside the URL. When this happens, the routing will not occur and a 400 Page Not Found error is returned to the client. It's like something is throwing the error before the routing collection is even consulted, because the route the URL should take is never touched (by that I mean the underlying code's break-point is never hit, though the exact same URL without the string "PRN" will hit the break-point).
So I thought it might be a page validation issue, that maybe Microsoft decided to throw exceptions when the URL contains the phrase "PRN" because it is like "print" or "porn" but if that were the case then we'd see the "A potentially dangerous Request.Form value was detected from the client" error, but we don't.
Researching this has been a hassle because Google thinks PRN should return results for "porn", which means 98% of my search results are invalid (and inappropriate). Using the "-porn" clause in Google drops your results down to about 10-30 hits, all useless.
Does anyone know why a URL containing the string "PRN" will not route properly? If you have any posts or threads to point me to, that would be awesome (again, Google has failed me).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论