Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi
I have a solution and under this solution there are 4 web service projects. Each of them has a separate web.config file of its own. However I have only one data access layer and connection string is in this project's web.config file. I would like all the projects use this projects web.config file. I do not want to define the same connection string in every project's web.config file. How do I do that?

Regards,
Posted
Comments
Sunasara Imdadhusen 22-Feb-11 7:11am    
Good question!!

1 solution

At deployment time, you can use configuration inheritance

http://msdn.microsoft.com/en-us/library/ms178685.aspx[^]

http://msdn.microsoft.com/en-us/library/dtbwsx8s%28v=vs.71%29.aspx[^]

You would have to structure your site in a certain way in order for the inheritance to come into effect

e.g

Application Root
Web.config
----Service1
----Service2
----Service3
----Service4


If you created a virtual directory and placed your web.config in that root folder, then create virtual directories from the root directory - they would inherit the settings defined in application root
 
Share this answer
 
Comments
fjdiewornncalwe 22-Feb-11 9:32am    
+5. Great answer and exactly what I was thinking when I read the question.

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