开发者

Is there a command or setting for a child web.config to ignore the parent web.config

I am running into a problem with a web.config in a child project that has the same connection string setting as a parent. We have this in several of our web a开发者_C百科pps but there is one case where we want a child not to use the parent web.config. Is there a setting or command in the child web.config to ignore the parent web.config?


If I understand your question correctly, you can also <clear /> out all previously defined connection strings from within your child web.config:

<configuration>
  <connectionStrings>
    <clear/>
    <add name="definedInParentButRedefinedHere" etc="..." />
  </connectionStrings>
</configuration>


In your web.config I think you want:

<location inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>


If it's just a connection string you're having a problem with, and you want to keep the rest of the parent:

<connectionStrings>
    <remove name="DB2"/>
    <add name="DB2"
         providerName="System.Data.Odbc"
         connectionString="Database=DEVDB;Uid={0};Pwd={1};"/>
</connectionStrings>


Reading configuraiton value should be child to parent. When you try to read config vlaue then it wil first look into current foler web.config then parent folder confing and last machine config. Not sure why this default behaviour is not working for you! You dont need do anything to read first from child then form pareant as its default.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜