Class Library reading Web.Config Settings?

T

Tony Jones

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
 
H

Hans Kesting

Tony Jones said:
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
 
M

Martin Marinov

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top