By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,949 Members | 1,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,949 IT Pros & Developers. It's quick & easy.

Class Library reading Web.Config Settings?

P: n/a
Is it possible for me to create a class library DLL and have it read it's
configuration settings from the web.config of the ASP.NET application
referencing it?

IE - if I call ConfigurationSettings.GetConfig("somesection") in one of the
base class dll methods, will it/can it return the settings from the
web.config?

For example, I would like to create a base class library of utility classes
that can be used with any ASP.NET application. Per ASP.NET application, you
can configure settings for the base class in the web.config with custom
configuration settings.

Thanks.

TJ
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Tony Jones" <to***************@hotmail.com> wrote in message news:O4**************@TK2MSFTNGP09.phx.gbl...
Is it possible for me to create a class library DLL and have it read it's
configuration settings from the web.config of the ASP.NET application
referencing it?

IE - if I call ConfigurationSettings.GetConfig("somesection") in one of the
base class dll methods, will it/can it return the settings from the
web.config?

For example, I would like to create a base class library of utility classes
that can be used with any ASP.NET application. Per ASP.NET application, you
can configure settings for the base class in the web.config with custom
configuration settings.

Thanks.

TJ


Yes, we do it like that. Works perfectly.

Hans Kesting
Nov 18 '05 #2

P: n/a
When you use an external dll in your application this dll will read from the
configuration file of your application when you use
ConfigurationSettings.GetConfig("somesection") ( in your case it will read
from the web.config file, because your application is web application )

But if you'll use the same dll in another application it will grab data from
it's configuration file

Regards
Martin

"Tony Jones" <to***************@hotmail.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Is it possible for me to create a class library DLL and have it read it's
configuration settings from the web.config of the ASP.NET application
referencing it?

IE - if I call ConfigurationSettings.GetConfig("somesection") in one of the base class dll methods, will it/can it return the settings from the
web.config?

For example, I would like to create a base class library of utility classes that can be used with any ASP.NET application. Per ASP.NET application, you can configure settings for the base class in the web.config with custom
configuration settings.

Thanks.

TJ

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.