Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Creating Custom Configuration Sections

Creating Custom Configuration Sections

Scheduled Pinned Locked Moved ASP.NET
questionworkspace
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AZBugsBunny
    wrote on last edited by
    #1

    I am trying to implement custom configuration sections in the web.config. I have included the following custom config setting in my web.config :

    I am now trying to retrieve the custom config values in my .cs codebhind file using the following code : System.Collections.Specialized.NameValueCollection nvc = (System.Collections.Specialized.NameValueCollection) System.Configuration.ConfigurationSettings.GetConfig("sitesettings/common/emails"); Label1.Text = nvc["salesmail"]; When I do this , I am getting the following exception : ex.Message : Exception creating section handler. (c:\inetpub\wwwroot\CustomConfig\web.config line 6) ex.Source : System.Web ex.StackTrace : at System.Web.Configuration.HttpConfigurationRecord.GetFactory(String configKey) at System.Web.Configuration.HttpConfigurationRecord.Evaluate(String configKey, SectionRecord section) at System.Web.Configuration.HttpConfigurationRecord.GetConfig(String configKey, Boolean cacheResult) at System.Web.Configuration.HttpConfigurationRecord.GetConfig(String configKey, Boolean cacheResult) at System.Web.HttpContext.GetConfig(String name) at System.Web.Configuration.HttpConfigurationSystemBase.System.Configuration.IConfigurationSystem.GetConfig(String configKey) at System.Configuration.ConfigurationSettings.GetConfig(String sectionName) at CustomConfig.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\customconfig\webform1.aspx.cs:line 53 Label Does anyone know what is wrong with my code? Thanks Sujatha

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups