Click here to Skip to main content
15,896,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The VB6 application I'm rewriting has a requirement to store application specific data that is accessible by other utility applications and libraries as well as all users of the workstation.

The application currently is using the HKEY_LocalMachine for storing this information which of course is cumbersome since this requires Admin Authority to add, modify, or delete.

So I need an idea on how to replicate this requirement without using the system registry.

To sum this up I need an idea how to store data which is accessible by all users on the system, other applications and libraries, and it can be modified without requiring Admin rights on the system.

Thanks for Any Suggestions!
Posted

1 solution

You can store your information in the CommonAppData folder.

Get the path to the folder using Environment.GetFolderPath(SpecialFolder.CommonApplicationData)[^].
 
Share this answer
 
Comments
Lowell D 29-Jul-14 13:15pm    
The following is an excerpt which indicates data written to the common application data can only be modified by the user who created the file.
"When you need to store data common to all users of an application locally, Microsoft recommend using System.Environment.SpecialFolder.CommonApplicationData. In addition they also suggest creating a sub folder here with your CompanyName and a sub folder in that of ApplicationName.

The issue with this is the folders and files you create only have read/execute permissions for other users other than the creator. This means that they cannot be appended to or replaced by another user without UAC elevation."

If this is correct then it is not an option.
Dave Kreskowiak 29-Jul-14 13:34pm    
Other users on the machine will have normal read/write permissions to the files so long as they are not already open by another user at the same time.

Unless you've got more than one user logged into the console at the same time, it'll work.
Lowell D 29-Jul-14 14:18pm    
Well I just tried it, the files have only read/execute rights for all users on the system other then the Creator Owner who has "Special Permissions".
We are running Windows 7 OS. The physical location for CommonApplicationData is C:ProgramData. Thanks for your suggestion but thought you would like to know that the other users don't have normal read/write permissions to the files.
Dave Kreskowiak 29-Jul-14 14:30pm    
Where I'm at, everyone has full permissions to the ProgramData folder.

In your case, it's easily fixed. Just create a folder under CommonAppData and then give Everyone Read/Write permissions to it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900