Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have a solution which contains more than 2 application including an asp.net website and console application. Both of the application using the same connection string and some common values. I want to create a separate config file to read those values and that config file will be placed anywhere in the system. I need to created a another utility to read that config file and fetch the values through that utility and use in both the application. Is there any method to achieve this?
Posted

1 solution

Hello,

If you are facing only problem with ConnectionString for both application so you can define more than one connectionString in one config file. I don't think that you need to use more than one config file for both.

Please refer this http://msdn.microsoft.com/en-us/library/ms254494.aspx[^]

example:
XML
<connectionStrings>
    <add name="connection1" connectionString="user id=user;password=123;server=10.0.0.1;database=myDatabase;connection timeout=30"/>
    <add name="connection2" connectionString="user id=user;password=123;server=10.0.0.2;database=myDatabase;connection timeout=30"/>
</connectionStrings>
 
Share this answer
 
Comments
PankajSaha 15-Feb-12 9:46am    
No, I have the same connection string and some common values. I do not want to add connection string and values in both the applications (asp.net, console). I just want to create a common config file and read that file through a another utility. I if use only one config file for the multiple application then it will be easy to change and configure for the multiple application.

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