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. General Programming
  3. C#
  4. Writing a custom section in config file

Writing a custom section in config file

Scheduled Pinned Locked Moved C#
databasetutorialquestion
4 Posts 3 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.
  • M Offline
    M Offline
    M J Jaya Chitra
    wrote on last edited by
    #1

    I am creating a project. In that I am having a section "Names" which is a customized section. Now based on the data in the database I want to create a key and value pairs in that section. I searched net but they have given the code to write the key value pair in the appsettings but not in the custom section Can any one tell me how to perform it through code? Many thanks in advance.

    Best Regards, M. J. Jaya Chitra

    L K 3 Replies Last reply
    0
    • M M J Jaya Chitra

      I am creating a project. In that I am having a section "Names" which is a customized section. Now based on the data in the database I want to create a key and value pairs in that section. I searched net but they have given the code to write the key value pair in the appsettings but not in the custom section Can any one tell me how to perform it through code? Many thanks in advance.

      Best Regards, M. J. Jaya Chitra

      L Offline
      L Offline
      laserbaronen
      wrote on last edited by
      #2

      [^ Maybe this will help]

      fafafa, ringakta icke sådant som bringa ack så naggande högönsklig välmåga å baronens ära.

      1 Reply Last reply
      0
      • M M J Jaya Chitra

        I am creating a project. In that I am having a section "Names" which is a customized section. Now based on the data in the database I want to create a key and value pairs in that section. I searched net but they have given the code to write the key value pair in the appsettings but not in the custom section Can any one tell me how to perform it through code? Many thanks in advance.

        Best Regards, M. J. Jaya Chitra

        K Offline
        K Offline
        Kenneth Ede
        wrote on last edited by
        #3

        You need two pieces ... First, in configSections, tell it there's a new custom section ...

        Then add the section ...

        1 Reply Last reply
        0
        • M M J Jaya Chitra

          I am creating a project. In that I am having a section "Names" which is a customized section. Now based on the data in the database I want to create a key and value pairs in that section. I searched net but they have given the code to write the key value pair in the appsettings but not in the custom section Can any one tell me how to perform it through code? Many thanks in advance.

          Best Regards, M. J. Jaya Chitra

          K Offline
          K Offline
          Kenneth Ede
          wrote on last edited by
          #4

          You need two pieces ... First, in configSections, tell it there's a new custom section ... <configSections> <section name="productCode" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> Then add the section ... <productCode> <add key="CV" value="AIG Commercial Vehicle" /> <add key="CY" value="Axa Private Car" /> <add key="MC" value="AIG Motorcycle (MCD)" /> </productCode>

          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