|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
saving common settings/data without administrative privilegesI am trying to find a way to save common data in my program that will not
change from different users. I tried both HKEY_LOCAL_MACHINE and writting to an ini file and storing it in my Program directory. However, in order for this to work, all the users need administrative privileges. Is there a proper way to store common data that I am not aware of? For example, I have a test number that I need to increment. And this test number must not change when the user changes. If you follow MS's guide, you would store application specific settings in
app.exe.config, which is located in the same folder of the app, and store user specifc settings in C:\Documents and Settings\UserName\AppcationData or C:\Docunemts and Settings\UserName\Local Settings\ApplicationData. With .NET2.0, you can specify a setting scope as "Application" or "User", and the settings would be saved to different location automatically, so that user can only read Application settings and read/write to his user settings. If you really want to use Registry's "LOCAL_MACHINE", yes, you need admin right to create a key. You can have an admin go to the computer to create that key before your app is used on that box; or you can make a installation package, and ask admin right to install it. During the installation, the key is created. In both the case, the key would be read-only to ordinary users. If you want user to be able to read/write, you have to give user(or user group) on that computer read/write permission to that key (do it via Regedt32, and it is clearly some sort of Registry abuse). Show quote "dgcooper" <dgcoo***@discussions.microsoft.com> wrote in message news:A2033837-C467-4A2A-A70C-3DEFEC277D91@microsoft.com... >I am trying to find a way to save common data in my program that will not > change from different users. I tried both HKEY_LOCAL_MACHINE and writting > to > an ini file and storing it in my Program directory. However, in order for > this to work, all the users need administrative privileges. > > Is there a proper way to store common data that I am not aware of? > > For example, I have a test number that I need to increment. And this test > number must not change when the user changes. |
|||||||||||||||||||||||