[英]Access denied in windows store app
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. 其他信息:Acces被拒绝。 (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) (HRESULT异常:0x80070005(E_ACCESSDENIED))
In Windows store app and how to fix this problem? 在Windows商店应用程序中以及如何解决此问题?
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:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.