开发者

IIS cannot serve pages ending with .config

This is obviously a security issue and probably do not want to change this, but it would be nice to handle the error. Any ideas?

I see that stackove开发者_如何学Gorflow is not immune:

https://stackoverflow.com/questions/tagged/web.config

They seem to have changed the tag to web-config to fix the problem but you still get a very nasty error message when you search for [web.config]


I believe this has been addressed in ASP.NET 4 with the addition of a new web.config setting

<configuration>
  <system.web>
    <httpRuntime relaxedUrlToFileSystemMapping="true"/>
  </system.web>
</configuration>

Phil Haack has more details.


In IIS 7, this can be found under Request Filtering. Other extensions that are filtered by default include:

  • .asax
  • .ascx
  • .master
  • .cs
  • .csproj

etc.

It's not a bug BTW, because the request gets filtered before ASP.NET gets a chance to process it. In other words, you could remove the request filter and have IIS process the extension if you want to, but make sure the extension is handled by ASP.NET and not the static file handler.

Edit: Maybe the answer for SO would be to change it so that when tags have a .XXX extension like web.config, they change to web-config or something else that IIS doesn't filter. This probably also would be a good topic on https://meta.stackoverflow.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜