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. app.config file

app.config file

Scheduled Pinned Locked Moved C#
csharpsaleshelpquestion
9 Posts 4 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.
  • D Offline
    D Offline
    dcof
    wrote on last edited by
    #1

    In a C# 2010 application, I want to place files in dynamic folder structures that I create in the application. I want to create these dynamic locations so we can place data in the dynamic paths based upon customer name. I also wantto place these dynamic paths in the app.config file. Thus can you tell me if there is a way to point the app.config file to these dynamic paths? If so can you tell me and/or point me to a reference I can use that will help me accomplish this goal?

    J 1 Reply Last reply
    0
    • D dcof

      In a C# 2010 application, I want to place files in dynamic folder structures that I create in the application. I want to create these dynamic locations so we can place data in the dynamic paths based upon customer name. I also wantto place these dynamic paths in the app.config file. Thus can you tell me if there is a way to point the app.config file to these dynamic paths? If so can you tell me and/or point me to a reference I can use that will help me accomplish this goal?

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      The root class for configuration management is the ConfigurationManager http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx[^] You can google for examples for updating the file itself. Note that if you want to do this while the application is running and thus AFTER you have already read and perhaps cached settings then you will need to set up a file watch and listeners.

      A 1 Reply Last reply
      0
      • J jschell

        The root class for configuration management is the ConfigurationManager http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx[^] You can google for examples for updating the file itself. Note that if you want to do this while the application is running and thus AFTER you have already read and perhaps cached settings then you will need to set up a file watch and listeners.

        A Offline
        A Offline
        Aby Thomas Varghese
        wrote on last edited by
        #3

        Hi jschell, Any updates to the config file itself will boot off the user using the site as on saving the file, IIS will try to reload that information, in effect ending all user sesisons. I think it would be a better idea to store this information in an application object which can later on be accessed. Let me know if I was wrong or misunderstood your point. Thanks and Regards,

        Thanks and Regards, Aby

        D P J 3 Replies Last reply
        0
        • A Aby Thomas Varghese

          Hi jschell, Any updates to the config file itself will boot off the user using the site as on saving the file, IIS will try to reload that information, in effect ending all user sesisons. I think it would be a better idea to store this information in an application object which can later on be accessed. Let me know if I was wrong or misunderstood your point. Thanks and Regards,

          Thanks and Regards, Aby

          D Offline
          D Offline
          dcof
          wrote on last edited by
          #4

          I make asked to come up with directory paths that look like the followiing: C://08-30-2012/Customer 1 C://08-30-2012/customer 2 C://08-31-2012/ customer 1 C://08-31-2012/customer 3. If you can not change the app.config file, how would you change to come up directory path names like I am just displaying?

          P 1 Reply Last reply
          0
          • A Aby Thomas Varghese

            Hi jschell, Any updates to the config file itself will boot off the user using the site as on saving the file, IIS will try to reload that information, in effect ending all user sesisons. I think it would be a better idea to store this information in an application object which can later on be accessed. Let me know if I was wrong or misunderstood your point. Thanks and Regards,

            Thanks and Regards, Aby

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            That's web.config, not app.config. App.config typically goes with desktop applications.

            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

            CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

            1 Reply Last reply
            0
            • D dcof

              I make asked to come up with directory paths that look like the followiing: C://08-30-2012/Customer 1 C://08-30-2012/customer 2 C://08-31-2012/ customer 1 C://08-31-2012/customer 3. If you can not change the app.config file, how would you change to come up directory path names like I am just displaying?

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Well, the first thing I see there is that you aren't basing the directory structure off the customer name. You are basing it off the date first, so your example doesn't match your stated requirements. Which one is right? You don't actually need to complicate things like this - all you need to do is create a common root path for the customer data, and then put the customers under that root path. For instance: c:\App Customers\Customer 1\08-30-2012 c:\App Customers\Customer 1\08-31-2012 c:\App Customers\Customer 2\08-30-2012 c:\App Customers\Customer 3\08-31-2012 Then you can just look for the appropriate customer path. Add yourself a little SQLLITE database and you can store the base path in there, along with any other dynamic information you need.

              *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

              CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

              1 Reply Last reply
              0
              • A Aby Thomas Varghese

                Hi jschell, Any updates to the config file itself will boot off the user using the site as on saving the file, IIS will try to reload that information, in effect ending all user sesisons. I think it would be a better idea to store this information in an application object which can later on be accessed. Let me know if I was wrong or misunderstood your point. Thanks and Regards,

                Thanks and Regards, Aby

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #7

                Aby Thomas Varghese wrote:

                IIS will try to relo

                First your original post said nothing about IIS nor really even about a server for that matter. Second however since you already know this then you, presumably, already know that there is not in fact any way for you, in your situation, to write it back to the web.config. So wouldn't that make your original question moot?

                Aby Thomas Varghese wrote:

                think it would be a better idea to store this information in an application object

                Far as I can determine your original question was about persisting the information. And presumably, since you can't use the config, then there are any number of alternative possibilities for persisting it. Such as writing to a file or a database.

                P 1 Reply Last reply
                0
                • J jschell

                  Aby Thomas Varghese wrote:

                  IIS will try to relo

                  First your original post said nothing about IIS nor really even about a server for that matter. Second however since you already know this then you, presumably, already know that there is not in fact any way for you, in your situation, to write it back to the web.config. So wouldn't that make your original question moot?

                  Aby Thomas Varghese wrote:

                  think it would be a better idea to store this information in an application object

                  Far as I can determine your original question was about persisting the information. And presumably, since you can't use the config, then there are any number of alternative possibilities for persisting it. Such as writing to a file or a database.

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  The person you replied to wasn't the OP.

                  *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                  "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                  CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                  J 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    The person you replied to wasn't the OP.

                    *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                    CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #9

                    Right you are.

                    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