Windows Vista (AppData and Application Data folders)

I have created an application and I'm trying to write to the user's Application Data directory on Windows Vista. However, I have not been successful. I am getting an "access denied" message in my test code and a FileNotFoundException is being thrown. I have no problems writing to the user's Application Data directory on Windows XP. I read somewhere that AppData is a copy of the user's Application Data directory and I believe that I can write to this directory (can you confirm this?). Is there any way to write directly to the user's Application Data directory if you are a non-administrator user? Either way, I'd appreciate an explanation of why or why not. Thanks
[686 byte] By [jrwalker2] at [2007-12-21]
# 1
You should be able to write to a file in that directory, but everyone is denied read/list permissions through that folder.

If this is a problem, you can open up a CMD prompt just above the Application Data folder and type "dir /ah". That'll show that Application Data is actually a JUNCTION (sort of like a shortcut) that actually points to another folder. The actual folder this junction points to should be shown as well. You should have normal access if your application deals with this folder directly.

TylerSample at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,General Windows Vista Development Issues...
# 2

%userprofile%\AppData\Local\
liujj_xujj at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,General Windows Vista Development Issues...
# 3
liujj_xujj wrote:

%userprofile%\AppData\Local\

Don't do that, it will break under numerous circumstances. Either use %localappdata% or ShGetKnownFolderPath if you are running on Vista, or use ShGetSpecialFolderPath if you need to run downlevel. .NET applications can also use the Environment.SpecialFolder class to retrieve the location of most special folders.

AndyCadley at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,General Windows Vista Development Issues...

Software Development for Windows Vista

Site Classified