Configuration file issue

  • Thread starter Thread starter Job Lot
  • Start date Start date
J

Job Lot

How can I make my application to expect config file under “C:\Documents and
Settings\All Users\Application Data\MyApplication†folder rather install
folder.

My app performs read/write operation on application configuration file that
gets installed under application folder (c:\program files\My Application). It
works alright on XP, but as soon as I run it on VISTA machine, I start
hitting virtualization & UAC issues.

How can make my app run under VISTA? Can I move the config file under
“C:\Documents and Settings\All Users\Application Data†folder? If yes, how
can I make my app to expect config file under “C:\Documents and Settings\All
Users\Application Data†rather app folder.

Thanks
 
Hi,
to read your configuration from some location you can use something similar to the code below:
string sPath = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "yourExe.exe");

Configuration config = ConfigurationManager.OpenExeConfiguration(sPath);

Take a look for different values of enum type Environment.SpecialFolder.

I hope this helps you.

Regards,

dlm@bypsoft
Compare Databases - SQL Server, MySQL, Oracle for free
www.bypsoft.com
 
Back
Top