Configuration ASP.Net Tutorial

<%@ Page Language="C#" %>
<%@ Import Namespace="MyNamespace" %>
<%@ Import Namespace="System.Web.Configuration" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    void Page_Load()
    {
        DesignSection section = (DesignSection)WebConfigurationManager. GetWebApplicationSection("system.web/design");
        htmlBody.Attributes["bgcolor"] = System.Drawing.ColorTranslator.ToHtml (section.BackColor);
        HtmlLink link = new HtmlLink();
        link.Href = section.StyleSheetUrl;
        link.Attributes.Add("rel", "stylesheet");
        link.Attributes.Add("type", "text/css");
        Page.Header.Controls.Add(link);
    }



    Show Design Section


    
    

    

Custom Configuration Section Sample


    

    


File: Web.config

  
    
            name="design"
        type="MyNamespace.DesignSection"
        allowLocation="true"
        allowDefinition="Everywhere"/>
    
  

  
          backcolor="red"
      styleSheetUrl="~/styles/style.css"/>