how can i use same web.config file for two web appliction?

273 views Asked by At

I have two web application. Their folder hierarchy in server is like that. first one is : .../firstapplitaion second is : .../firstapplication/secondapplication/Default.aspx

At first can i run them with just firstapplication's web.config file? secondapplication's web config hasnt any special things.

Thanks for your helps..

2

There are 2 answers

0
Peter On BEST ANSWER

If the second app's web.config file is the same why bother to even run them as seperate apps? Why not just make them one app that uses the same web.config? Or were you trying to split them into seperate app pools?

What I have done in a similar situation was to have each site contain it's own seperate web.config but to move all of the shared pieces into my Machine.config. For me it's locatd in the C:\WINDOWS\Microsoft.NET\Framework\vX.X.XXX\Config folder (I would suggest backig it up first). Because of the way the config files work you can put settings in your machine.config and your websites will inherit these settigs. So put any shared settings there, with very unique names, and you should be set.

0
Mark Dickinson On

One way would be to have a section in your web.config files point to an appropriate file, like this

<configuration>
   <appSettings file="C:\MyCommonFolder\MyCommonAppSettings.config">
   </appSettings>
</configuration>

Hope that helps