Setting class property in web.config file

  • Thread starter Thread starter JollyK
  • Start date Start date
J

JollyK

Hello folks,

I know about the appsettings attribute, but I would like to know if there is
a way to set a class property in a web.config file?

for example, suppose I have a the following code

Code:
namespace Test
{
class ClassA
{
private string _strName;

public string Name
{
set {this._strName = value; }
}
}
}

Is there anyway I can set the property called Name in the web.config file?

If it is possible, can u show me how?

Thanks alot
 
JollyK said:
Is there anyway I can set the property called Name in the web.config file?

If it is possible, can u show me how?

Thanks alot

Whenever you instanciate the class, you would have to load it from
web.config.

Alternatively, you could use the constructor to read the value from
web.config and load it.
 

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

Back
Top