hi,
I want to know that what is the use of custom tag in web config file in web application ?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted May 1, 2012, 9:00 AM EDT
Custom tag allows you to create your own tag and specify key value pair for it.
To add a custom tag to Web.config you need to first explicitly specify the new tag name in Web.config via the
Please refer the below links
http://www.codeproject.com/Articles/32628/ASP-NET-Custom-Web-Configuration-Section
http://24x7aspnet.blogspot.in/2009/06/customized-tags-add-in-webconfig.html
Thanks
SenthilkumarRank #387 · 6.5K reputationPosted May 2, 2012, 3:11 AM EDT
The use of custom tag, you can set the constant value in the web.config file and it can be referenced throughout the application.
It will be one point of location to change and reflect every where in the application.
More over it has the advantages of no need to do code compilation when ever you change something. Because it is an xml configuration file and can be edited in the web server as well.
for example,
I want to define the path to create the application log files then
Now the client wants to change this into D drive then if you have hard coded any where in the code then it has to be recompiled and deployed.
But it is an configurable in the web.config file, so i simply go and change it.
Hope this will help you to understand.
MuthuMari MRank #5,738 · 288 reputationPosted May 2, 2012, 3:30 AM EDT
Yes allows to create own tags in web.config file.
In the section add the following code
Then you add you custom tag in section
This custom tag should not be in tag.
In C# file you can access the value of the custom tag as
string strCustomTag = ((NameValueCollection)ConfigurationSettings.GetConfig("muthu"))["Test"];
For NameValueCollection add using System.Collections.Specialized; namespace
thanks.
If this post is useful then mark it as "Accepted Answer"