ASP.NET Web 应用程序对于以“.sitemap”结尾的 URL 返回 404
我们的网络服务提供类似于以下的 API:"/api/
。
如果客户使用任何以“.sitemap”结尾的值,此 API 将返回 404,而不会触发我们的代码。我们的代码库中没有任何内容可以对这个特定后缀执行任何特殊操作。
我们的假设是,它可能与 ASP.NET 站点地图安全修剪有关:https://learn.microsoft.com/en-us/previous-versions/aspnet/ms178428(v=vs.100)
任何如何禁用它的想法(即允许客户使用以“.sitemap”)?
Our web service provides API similar to this: "/api/<customer-provided name>?parameter="
.
This API returns 404 without hitting our code if customer uses any values ending with ".sitemap". There is nothing in our codebase which does anything special for this particular suffix.
Our hypothesis is that it can be related to ASP.NET Site-Map Security Trimming: https://learn.microsoft.com/en-us/previous-versions/aspnet/ms178428(v=vs.100)
Any ideas how to disable it (i.e. allow customers to use values ending with ".sitemap")?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是阻止 URL 结尾的默认 ASP.NET 行为,这些 URL 结尾代表一些众所周知的文件扩展名(
.sitemap
、.cs
等)。添加以下
fileExtensions
部分修复了该问题:Turned out to be default ASP.NET behavior of blocking URL endings which represent some well known file extensions (
.sitemap
,.cs
, and many more).Adding the following
fileExtensions
section fixed it: