Answered by:
application settings , config files for custom assemblies

Question
-
User853731431 posted
Within a class library, how can I read config settings for the web application.
Do I need to use System.Web.Configuration.WebConfigurationManager or System.Configuration.ConfigurationManager ?Tuesday, April 8, 2008 11:24 AM
Answers
-
User-2115483147 posted
Well, one reason I ask is that my current class library Im using is referencing System.Configuration.ConfigurationManager to read settings in my web.config file. It seemed like that shouldnt work, and would instead need to use the WebconfigurationManager class
comments ?
Hi BitShift,
I suggest you give up to read web.config and please use an XML file instead of it.
Hope it helps,
Hong Gang
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 10, 2008 3:04 AM
All replies
-
User-837620913 posted
Check out this page:
http://www.bearcanyon.com/dotnet/
And look for "Per-Assembly Configuration Files"
Tuesday, April 8, 2008 11:44 AM -
User853731431 posted
Well, one reason I ask is that my current class library Im using is referencing System.Configuration.ConfigurationManager to read settings in my web.config file. It seemed like that shouldnt work, and would instead need to use the WebconfigurationManager class
comments ?
Tuesday, April 8, 2008 12:08 PM -
User-2115483147 posted
Well, one reason I ask is that my current class library Im using is referencing System.Configuration.ConfigurationManager to read settings in my web.config file. It seemed like that shouldnt work, and would instead need to use the WebconfigurationManager class
comments ?
Hi BitShift,
I suggest you give up to read web.config and please use an XML file instead of it.
Hope it helps,
Hong Gang
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 10, 2008 3:04 AM -
User-837620913 posted
If you use the ConfigurationManager in a class library, it will use the config file from whatever application loaded your class library. If you create a web application with a web.config, and use ConfigurationManager.AppSettings in a class library, it can access the AppSettings in the web.config file.Friday, April 11, 2008 11:00 AM