Wednesday, December 29, 2010

How to set a variable in web.config file of ASP.NET.

web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
. . .
<appSettings>
<add key="cfgWebTitle" value="Memo8.com" />
</appSettings>
</configuration>



Use (C#)
string cfgWebTitle=ConfigurationManager.AppSettings["cfgWebTitle"].ToString();
Response.Write(cfgWebTitle);


Reference : http://www.memo8.com/toolkits/archives/487

No comments: