Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,

I have two Configuration Files to be used in My Asp.net Project, Also There are few keys in app settings which is directly added inside the app settings tag. If i have 1 File reference with keys in my webconfig it works properly, but if i have more than 1 file reference to appsettings none of the key works and throws error .

XML
<appSettings file="config/first.config,config/second.config">
    <add key="Hi" value="Hellooooo"/>
</appSettings>

I saw an article which could override the Desearialize method of Appsettings, but i am unable to do so .. As the Asp.Net class is Sealed

Reference Article
adding multiple file in app setting[^]

Is there any way for me to use multiple config file for the app settings?

I saw the below link ,seems quite a deal ,but is there any simpler way ?
Configuration Manager for the Enterprise[^]
Posted
v2

1 solution

Dear Friend,

You can control the two app config files or two web config files working by separately putting them in the respective folders where you want to use the App Key accordingly.

I have also earlier faced this problem and tried this solution. It also might work in your case.

Please let me know if it works and also don't forget to mark this as your answer if it works.

Regards

Varun Sareen
 
Share this answer
 
v2
Comments
dilipprasad87 22-May-13 5:09am    
yes, but here i am using multiple files for app settings and i dont want to have multiple appconfig/webconfig
Varun Sareen 23-May-13 5:13am    
I couldn't get you here dear friend. Please elaborate.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900