Web.Config继承重写解决方案

2011-07-07 阅读数:1983

很多人有时都会为虚拟目录中的web.config继承了主目录中的web.config而苦恼,大部分主要是由于根目录中的web.config添加了httphandler、 httpmodule 引起的。

其实这个问题解决起来很简单,只将 httphandler httpmodule的声明添加到location中即可。

如下所示:

<location path="." allowoverride="true" inheritinchildapplications="false"> 

<system.web>

//Web配置在这里

</system.web>

</location>
 

path 不用说指定的是一个目录 allowOverride 指是否可以将这个重写 inheritInChildApplications 指是否被子级应用程序继承

必須在上一层虚拟目录(如根目录)所在的Web.config加上
如:<location path="." allowOverride="false" inheritInChildApplications="false"> </location>

path 不用说指定的是一个目录
allowOverride 指是否可以将这个重写
inheritInChildApplications 指是否被子级应用程序继承

声明: 本文采用 BY-NC-SA 协议进行授权. 转载请注明转自: Web.Config继承重写解决方案

相关评论

验证码: