Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This line

SqlDatabase sqlDatabase = EnterpriseLibraryContainer.Current.GetInstance<SqlDatabase>(connectionName);


in my application is used to retrieve connection string from config file but the problem we have nearly 4 web config files as
1.web.config
2.web.debug.config
3.web.ct7.config

i dont know from which file the connection is retrieved. any idea how to find it out. please share.

What I have tried:

i tried changing the values in all config files but problem is the application does not load if we change and run again. also i changed at runtime but couldnt find it out
Posted
Updated 7-Sep-17 2:01am

1 solution

We can use this line of code.
C#
string config = System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
This gives the value of which config file is being retrieved & used.So if there is N layers in your application & each layer has a config file & if u want to find which config file is read the above code can be used.
 
Share this answer
 

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