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