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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MuthuMari MPosted May 2, 2012, 7:30 AM
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"SenthilkumarPosted May 2, 2012, 7:11 AM
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.
Satyapriya NayakPosted May 1, 2012, 1:00 PM
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