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. Configuration Files

Configuration Files

Scheduled Pinned Locked Moved C#
questiondesignsecurityxmlhelp
3 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.
  • B Offline
    B Offline
    BrianEllis
    wrote on last edited by
    #1

    I am planning the design of a small app (read: a few hundred lines, fast execution). The app will run behind the scenes with no user I/O. I am looking into configuration files and I was considering using a local .ini or .xml file. Question: Which should I use? (Subquestion: should I use one?). The settings would probably only include a few crucial settings and due to the nature or the beast, a few of those would need to be encrypted (password fields or so.) Looking at the problem now I'm thinking it may be far simpler to just hard-code the user names and passwords into the file, but I hate doing that. XML would be fast and easy but it's large and unnecessary while .ini files would be the proper size but I don't know about any facilities for encryption at the field level. Any suggestions? Thanks. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - Douglas Adams

    H 1 Reply Last reply
    0
    • B BrianEllis

      I am planning the design of a small app (read: a few hundred lines, fast execution). The app will run behind the scenes with no user I/O. I am looking into configuration files and I was considering using a local .ini or .xml file. Question: Which should I use? (Subquestion: should I use one?). The settings would probably only include a few crucial settings and due to the nature or the beast, a few of those would need to be encrypted (password fields or so.) Looking at the problem now I'm thinking it may be far simpler to just hard-code the user names and passwords into the file, but I hate doing that. XML would be fast and easy but it's large and unnecessary while .ini files would be the proper size but I don't know about any facilities for encryption at the field level. Any suggestions? Thanks. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - Douglas Adams

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Use a .config file - the standard configuration file for .NET applications. Besides including all sorts of runtime configuration, key/value app settings, and what not - it's also an extensible system. See the IConfigurationSectionHandler interface in the System.Configuration namespace in the .NET Framework SDK for more information. This is best, IMO, because it keeps an application's configuration in a common place and works with the .NET configuration model, which also includes general settings using the machine.config file. While the documentation I mentioned should mention this, a .config file is either Web.config for ASP.NET or MyApplicationName.exe.config (obviously, replace "MyApplicationName" with the actual exec name) and is in the same directory as the application. This is all default, anyway.

      Microsoft MVP, Visual C# My Articles

      B 1 Reply Last reply
      0
      • H Heath Stewart

        Use a .config file - the standard configuration file for .NET applications. Besides including all sorts of runtime configuration, key/value app settings, and what not - it's also an extensible system. See the IConfigurationSectionHandler interface in the System.Configuration namespace in the .NET Framework SDK for more information. This is best, IMO, because it keeps an application's configuration in a common place and works with the .NET configuration model, which also includes general settings using the machine.config file. While the documentation I mentioned should mention this, a .config file is either Web.config for ASP.NET or MyApplicationName.exe.config (obviously, replace "MyApplicationName" with the actual exec name) and is in the same directory as the application. This is all default, anyway.

        Microsoft MVP, Visual C# My Articles

        B Offline
        B Offline
        BrianEllis
        wrote on last edited by
        #3

        Duh, I should have thought about that. :sigh: For some reason the standard .config completely slipped my mind. Thanks very much Heath. Brian "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." - Douglas Adams

        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