Why am I getting an error in this code?
StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile sampleFile = await folder.CreateFileAsync("sample.jpg", CreationCollisionOption.ReplaceExisting);
Error:
Additional information: Acces denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
In Windows store app and how to fix this problem?
You should not (or cannot) use app installed location to create files because it is read-only.
If you want to create app files you should use another directory like:
StorageFolder folder = ApplicationData.Current.LocalFolder:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.