Re: Append to App.exe.config at run time
From: Marc Scheuner [MVP ADSI] (m.scheuner_at_inova.SPAMBEGONE.ch)
Date: 06/03/04
- Next message: Cor Ligthert: "Re: Memory in windows forms"
- Previous message: Jon Skeet [C# MVP]: "Re: Strange problem of "read" method of filestream class."
- In reply to: V.Boomessh: "Append to App.exe.config at run time"
- Next in thread: V.Boomessh: "Re: Append to App.exe.config at run time"
- Reply: V.Boomessh: "Re: Append to App.exe.config at run time"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 03 Jun 2004 07:52:35 +0200
>I read a encrypted text file which contains details of SQL Server name, SQL DBName etc...
>for DB Connection and i prepare a connection string for global use.
>I also read from a book, that the connection string can be placed in "appname.exe.config"
>file for windows application.
>Is there any way to write/append key value pairs into the config file at run time.
Not out of the box, no. By default, the myapp.exe.config files are
considered read-only, which makes good sense if you think about it -
they'll be located in the same directory as the app, which normally
isn't one that the average user (at least in a corporate environment)
has write access to anyway.
Since the .config files are nothing but straight XML files, you can
easily write your own class to load the existing XML config file, add
or modify entries, and write the XML file back. MIND YOU: check for
permission to do so!! You might not be able to write it back (since
your user running your app might not have write permission where the
file is located).
Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
- Next message: Cor Ligthert: "Re: Memory in windows forms"
- Previous message: Jon Skeet [C# MVP]: "Re: Strange problem of "read" method of filestream class."
- In reply to: V.Boomessh: "Append to App.exe.config at run time"
- Next in thread: V.Boomessh: "Re: Append to App.exe.config at run time"
- Reply: V.Boomessh: "Re: Append to App.exe.config at run time"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|