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.
 
Back
Top