Feeds:
Posts
Comments

Archive for December, 2007

Sometime we need to add custom tags or key in web.config. It is easy to add key in <appSettings> and easy to access fromc# code.

web.config looks like that:

<appSettings>
    <add key=”Name” value=”Ashrafur Rahaman”/>
    <add key=”Address” value=”Kuala Lumpur, Malaysia” />
    <add key=”Contact” value=”faisal10dec@gmail.com” />
</appSettings>

c# code for access key value:

using System.Collections.Specialized;
using System.Configuration;

NameValueCollection sAll = ConfigurationManager.AppSettings;
foreach (string s in sAll.AllKeys)
{
        Label1.Text += “Key” + s + ” value:”+ sAll.Get(s)+”<br/>”;
}

Read Full Post »