ASP.NET configuration not linked to library

I am working on a solution having two projects, one ASP.NET web application and one custom web control library. Custom control library used in asp.net application. When I compile the solution, the app.config file of the custom web control library is not passed from the dll to the bin folder of the ASP.NET apllications? How can i do this? And which class should read this Config file

0


source to share


2 answers


When you run the library from the context of a web application, then the .config file used is based on that context only. Therefore the settings you have should be available in the web.config for web use and in the app.config for offline use / use of forms.



One solution I have used in the past is to write my own logic to export the inline settings file from the library to the working directory, and always reference that file directly from the working directory. This means that you can use library settings from any context, but make sure there is one point of contact available for the settings.

+1


source


System.Configuration.ConfigurationManager.AppSettings is the access to the NameValueCollection.

It's also worth mentioning that machine.config can have a say in the configuration, for good or bad.



The FAQ is here .

+1


source







All Articles