views:

36

answers:

2

I have an ASP.net solution that includes 2 projects. One of them is basically a class library and the other is a web service that references the class library.

I want the library to use a web.config to access global connection strings yet I want the library to be able to function independently of the service. There is a web.config file in the web service project that both the library and the service are currently using. How can I create a separate config file inside the library project so it doesn't have to access the one inside the service? It seems I am able to simply create a new web.config file under the Library but I can't figure out how to access it.

A: 

Can't you use the Project -> Settings which in turn creates an app.config file for your use?

I'm using the Web.config file for all User Interface (UI) information, and I use the app.config in the core project (Class Library) to store the encrypted connection string as well as other "settings" used by the core project.

rockinthesixstring
A: 

As far as I know, you can't create multiple independent web.config files in your application. Instead, use the location sections in your root web.config.

You can use multiple web.config files though to better partition your configuration settings using appSettings.

That's the only solution I know of.

treefrog