虚拟目录中的web.config继承了主目录中的web.config大部分主要是由于根目录中的web.config添加了httphandler、 httpmodule 引起的。
只将 httphandler httpmodule的声明添加到location中即可。
如下所示:
<location path="." allowOverride="true" inheritInChildApplications="false">
<system.web>
<httpModules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
</location>
path 不用说指定的是一个目录 allowOverride 指是否可以将这个重写 inheritInChildApplications 指是否被子级应用程序继承。

本文介绍了如何在ASP.NET应用程序中通过配置web.config文件来控制虚拟目录与主目录之间的配置继承,特别是关于httphandler和httpmodule部分的配置。

159

被折叠的 条评论
为什么被折叠?



