Adding Custom Tags in Web.config

To add cutom tag in your web config its a simple process. I will expain it step by step

Add  Following to your web config


Remember you have to add information about your System assembly which you can find in your GAC (Global assembly cache) Path: "C:\WINDOWS\assembly" right click on System assembly and you will get Property about it.

Then to get those custom tag values  write the following code on default.aspx.cs file

 protected void Page_Load(object sender, EventArgs e)
{      
NameValueCollection Col = new NameValueCollection();
Col = (NameValueCollection)System.Configuration.ConfigurationManager.GetSection("MyCustomSection");
        for (int i = 0; i < c1.Keys.Count; i++)
        {
           Response.Write(String.Format("Key = {0}, Value = {1} ", c1.Keys[i], c1[i].ToString()));          
        }       
}



Comments

Popular posts from this blog

How to get motherboard serial number, Processor ID, VolumeSerialNumber using C#?

Fiserv Interview Questions.

AngularJs - Simple Example