How can we add our custom tag in web.config
We can add our custom tags in web config. I got solution from internet with below example. Please check below:
<configuration> <configSections> <sectionGroup name="Test"> <section name="pageStyle" type="Xpode.MyName, MyStyle" /> </sectionGroup> </configSections> <devhood> <pageStyle backColour="navy" /> </devhood> </configuration>
namespace Xpode { internal class MyName : IConfigurationSectionHandler { public virtual object Create(Object parent, Object context, XmlNode node) { MyStyle config = new MyStyle((PageStyle)parent); config.LoadValuesFromConfigurationXml(node); return config; } }
public class MyStyle { string _backColour;
internal MyStyle(PageStyle parent) { if (parent != null) _backColour = parent._backColour; }
internal void LoadValuesFromConfigurationXml(XmlNode node) { XmlAttributeCollection attribCol = node.Attributes; _backColour = attribCol["backColour"].Value; }
public string BackColour { get { return _backColour; } } } }
Contributed by:
Guest
Guest user is that user who have done some activity on website without login. Activity contains commenting on any article, uploading an image on website etc.
Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=161
Click here to go on website
|