Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing sections from Web.config
Message
From
06/11/2009 09:07:51
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
ASP.NET
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01433550
Message ID:
01433553
Views:
32
Oh, I think I see the issue. It isn't that I have the section for databases, it is that I have another sectionGroup defined which is the same.
<section name="databases" type="System.Configuration.NameValueSectionHandler, 
So I should be able to either add a clear here like this
<configuration>
     <configSections>
          <clear />
          <section name="databases" type="System.Configuration.NameValueSectionHandler, 
or just remove the definition in the second web config and then add the clear (don't really need to though) within the section to clear any earlier databases like this. The keys don't collide so the clear wouldn't be needed here but not a bad idea.
<databases>
    <clear />
       <add key="MSAMain\Connection" value="server=......" />
       <add key="MSAMain\DataAccessClass" value="DataAccessSql" />
Am I on the right track now?
Thanks
Tim

>< clear / >
>
>>Hi all,
>>
>>I have a website hosted with a web.config file. In the config file there is sections defined for databases and databasesets. Now I am putting another web application behind this one so essentially if you navigate to a subfolder it is a virtual directory and a different web application. I have another web config file there with the same sections defined. I removed the databasesets definition under configSections as I don't need it but the databases section I do need. It is causing an error as it is already defined in the first web.config.
>>
>>How do I clear or remove it before re-defining the section in the second web.config?
>>
>>I suppose I could add my second configuration of databases to the first web.config and just remove it from the second one but that isn't very friendly for having the configurations near the application.
>>Thanks for any help on that.
>>Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform