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. Web.Config

Web.Config

Scheduled Pinned Locked Moved Web Development
questioncsharphtmlxmlworkspace
4 Posts 2 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
    Maharishi Bhatia
    wrote on last edited by
    #1

    Hi All, I am working on a .Net library to be used within the organization. There are lot of configuration settings for the library. Now the question is whether i put all the configuration in the web.config file and access using the configsectionhandler interface or should i put the configuration in a seperate xml file and access using XML DOM. One of the reason i asking this bcos if we change anything in the web.config file the whole application resets which i donot want. Can anyone please tell me which one is a better approach and why ???? Thanxs in advance. Maharishi Bhatia :)

    S 1 Reply Last reply
    0
    • M Maharishi Bhatia

      Hi All, I am working on a .Net library to be used within the organization. There are lot of configuration settings for the library. Now the question is whether i put all the configuration in the web.config file and access using the configsectionhandler interface or should i put the configuration in a seperate xml file and access using XML DOM. One of the reason i asking this bcos if we change anything in the web.config file the whole application resets which i donot want. Can anyone please tell me which one is a better approach and why ???? Thanxs in advance. Maharishi Bhatia :)

      S Offline
      S Offline
      Steven Campbell
      wrote on last edited by
      #2

      My personal view on this is "neither". Rather structure your library's methods and constructors so that they accept the settings as parameters. Then, it is up to the caller application to either hard-code the values or deal with the config file issue. This approach also makes for easier unit testing your library, because your tests can easily deal with several different testing scenarios.


      my blog

      M 1 Reply Last reply
      0
      • S Steven Campbell

        My personal view on this is "neither". Rather structure your library's methods and constructors so that they accept the settings as parameters. Then, it is up to the caller application to either hard-code the values or deal with the config file issue. This approach also makes for easier unit testing your library, because your tests can easily deal with several different testing scenarios.


        my blog

        M Offline
        M Offline
        Maharishi Bhatia
        wrote on last edited by
        #3

        Hi Steven, Thanxs for the prompt answer. Let me rephrase my question... I have already made the library with librarys method and constructors that accept the settings as parameter. I am trying to make a wrapper class which will read from a settings file so that the developer doesnt have to write any code to pass setting data to the library. So actually i was looking for a solution whether to put the config settings in the web.config file or to put it in a seperate xml file. And which solution will be better... Thanxs in advance. Maharishi Bhatia Nothing is Impossible. Even impossible spells "i m possible"

        S 1 Reply Last reply
        0
        • M Maharishi Bhatia

          Hi Steven, Thanxs for the prompt answer. Let me rephrase my question... I have already made the library with librarys method and constructors that accept the settings as parameter. I am trying to make a wrapper class which will read from a settings file so that the developer doesnt have to write any code to pass setting data to the library. So actually i was looking for a solution whether to put the config settings in the web.config file or to put it in a seperate xml file. And which solution will be better... Thanxs in advance. Maharishi Bhatia Nothing is Impossible. Even impossible spells "i m possible"

          S Offline
          S Offline
          Steven Campbell
          wrote on last edited by
          #4

          Like you say, web.config is not always the best choice, although it is certainly the easiest. Some options: * Use a generalized config API, like Nini * Use an external config file * Use your own home grown config solution


          my blog

          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