locked
Folder for Common User settings... RRS feed

  • Question

  • What folder (Environment.SpecialFolders) should be used for settings (ie an SMTP server at the company) which can be edited by all users on a machine?

    I'm 90% sure I know the answer, but hope springs eternal.

    Thanks
    Thursday, January 15, 2009 7:55 PM

All replies

  • If you absolutely have to have a shared data file, the you need to create a sub-folder under SpecialFolder.CommonApplicationData and apply appropriate ACLs.

    However, that's not what I'd do if it's just a simple setting such as an SMTP server. You'd be much better off writing the code to use the registry and have a per-machine override for user-settings. That way you can check for the existence of a key under HKLM and if present, use that. Otherwise read a per-user configurable value from an equivalent location under HKCU. When writing the value, try HKLM first, if that fails write to HKCU instead.

    For real value-add, add Group Policy support by checking for equivalent keys under HKLM\Software\Policies and HKCU\Software\Polices first and use those values if present (disabling any configuration UI). Then provide an ADM template to allow those settings to be managed by Active Directory.
    Monday, January 19, 2009 4:42 PM