ConfigurationSettings.AppSettings.Set question

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

If I use ConfigurationSettings.AppSettings.Set("KeyName", "KeyValue"), where
does the KeyName/KeyValue combination ends up? In a file? In windows
registry?

Thanks

Regards
 
ConfigurationSettings.AppSettings is a sort of read-only collection. Even
though you can still call Set() method the key/value exists only for the
life-time of the web app. That is, if you restart the web app, the set
key/value wont exist.

BTW, this read-only collection gets populated from web.config's
<appSettings> section.

Also, note that ConfigurationSettings.AppSettings is obsolete in .NET 2+. It
has been replaced by System.Configuration.ConfigurationManager.AppSettings (
in system.configuration assembly).
 
John, do yourself & everyone else a favor & create an ini file in your app's
directory & leave the registry etc alone. I hate waiting for windows to
process a bloated registry of deleted or non existant app entries. VB 1.0
did get one thing right. Leave your stuff out of the system directory too.
Thanks
 
John, do yourself & everyone else a favor & create an ini file in your app's
directory & leave the registry etc alone. I hate waiting for windows to
process a bloated registry of deleted or non existant app entries. VB 1.0
did get one thing right. Leave your stuff out of the system directory too.

I agree with the registry advice, but the advice to use an .ini file
in the app's folder is not as sound. Windows Vista may not allow your
program access to the program's folder. There is a "Program Data"
folder, I believe, that is used for that purpose, or you could use the
user's documents folder for that purpose. So if your app target's
Windows Vista, keep this in mind.

Chris
 
Back
Top