Reputation: 3618
We have a DLL and it has its own app settings. Now if I use the dll in the ASP .Net website, ConfigurationManager.AppSettings[key]
is looking at website's web.config instead of DLL's App.config.
Is it possible to get the config settings in the DLL's app.config rather than website's web.config?
Any help is much appreciated.
Thanks,
Raja
Upvotes: 2
Views: 1031
Reputation: 499272
A DLL cannot have its own configuration.
A library executes in the context of an application (web or otherwise) - the configuration is that of this application.
Upvotes: 3
Reputation: 77
I'm using the code below to get my dll's config. Hope it helps.
_config = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location);
_rootPath = _config.AppSettings.Settings["RootPath"].Value;
Upvotes: 1