Reputation: 2442
I'm doing a simple image resize and on the final I want to save it like:
path = "C:\\new_image.jpg";
img.Save(path, jpegCodec, encoderParams);
The problem is it saves to "....... \Users\Ervin\AppData\Local\VirtualStore\" . What did I do wrong or what did I miss out?
UPDATE: I changed the path to an other folder, and it works. it seems I can't save to C:\ only.
Upvotes: 2
Views: 4491
Reputation: 1499780
This was introduced in Vista, called Virtualization:
File virtualization addresses the situation where an application relies on the ability to store a file, such as a configuration file, in a system location typically writeable only by administrators. Running programs as a standard user in this situation might result in program failures due to insufficient levels of access.
When an application writes to a system location only writeable by administrators, Windows then writes all subsequent file operations to a user-specific path under the Virtual Store directory, which is located at %LOCALAPPDATA%\VirtualStore. Later, when the application reads back this file, the computer will provide the one in the Virtual Store. Because the Windows security infrastructure processes the virtualization without the application’s assistance, the application believes it was able to successfully read and write directly to Program Files. The transparency of file virtualization enables applications to perceive that they are writing and reading from the protected resource, when in fact they are accessing the virtualized version.
Upvotes: 1
Reputation: 127543
The resion for this is the user you are running as does not have write permissions to write directly to the C: drive this was new to either Win7 or Vista I am not shure which.
You can solve this by:
....... \Users\Ervin\AppData\Local\VirtualStore\ was added to help fix legacy applications when you updated. You may also notice a lot of entries in the "Program Files" in the virtual store. these are programs trying to write to their own directory in program files instead of %LOCALAPPDATA% like they should.
Upvotes: 3