Pages

Search This Blog

Thursday, November 8, 2007

Global variable In web.config

Let's say want to add a variable deployment in web.config, add
<appsettings><add value="0" key="deployment"></appsettings>to <configuration></configuration>if <appsettings></appsettings>not exist in web.config.


<configuration>
<appsettings>
<add value="0" key="deployment">
</appsettings>
</configuration>


to call the variable in C# code,

string strDeployment = System.Configuration.ConfigurationSettings.AppSettings["deployment"];

Done