天天看點

關于虛拟目錄繼承根Web.Config的問題解決辦法

很多人有時都會為虛拟目錄中的web.config繼承了主目錄中的web.config而苦惱,

大部分主要是由于根目錄中的web.config添加了httphandler、 httpmodule 引起的。

其實這個問題解決起來很簡單,隻将 httphandler httpmodule的聲明添加到location中即可。

如下所示:

<configuration>

<location path="." allowOverride="true" inheritInChildApplications="false">

<system.web>

    <httpModules>

      <add name="UrlRewriteModule"

            type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

    </httpModules>

</system.web>

</location>

</configuration>

path 不用說指定的是一個目錄

allowOverride 指是否可以将這個重寫

inheritInChildApplications 指是否被子級應用程式繼承   

  摘自:http://nt.discuz.net/showtopic-33071.aspx#243568