Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If I do this:
MIDL
AppDomain.CurrentDomain.SetData("DataDirectory",System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData));

and have Setup put the files there, my program can't access them.

If I change the location to .LocalApplicationData, it works just fine, but is restricted to whoever installed it.

So how do make it work for "all users", if a normal user can't access the common dirs?

I thought Common was for all, LocalApplicationData was for a specific user, and plain .ApplicationData was for "roaming".

What am I doing wrong?
Posted

1 solution

Is it possible that Setup's running as Admin and thus creates the files under Admin's ownership?

Also you probably need to add a sub-folder specific to your application. The base folder may not have write-access for non-Admin users.
 
Share this answer
 
v2
Comments
GenJerDan 8-Feb-11 13:35pm    
The setup isn't specifically running as Admin, but yes, it apparently does it anyway or it's inherited because of the location... Looking at other apps in that directory, they're all owned by System or Administrators with limited access to anyone else... So how do the other "anybody" apps read and write there if they're not running as admin? I have to elevate in my app?
GenJerDan 8-Feb-11 13:47pm    
OK. That's ridiculous...maybe. If I *DO* run the setup as Admin, the app works just fine from that directory for everyone. Guess that would have been nice to put in the documentation and How-Tos. <sarcasm>Thanks MS.

'Though I guess it makes sense...only an Admin should be able to install for everyone...in a paranoid world.
The inverse of your answer fixed it... LOL.
Nish Nishant 8-Feb-11 13:51pm    
Oh well, at least your problem's solved :-)
Sergey Alexandrovich Kryukov 8-Feb-11 15:44pm    
I knew you would sort out this small thing :-)
My 5,
--SA

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