I want to open a file through URL in Win8 store app. Below is the code.
var uri = new Uri(uriToLaunch);
var options = new Windows.System.LauncherOptions();
options.TreatAsUntrusted = false;
var success = await Windows.System.Launcher.LaunchUriAsync(uri, options);
Actually, the code runs well in the debug mode. And in that way, the file is opened.
The problem is, when I build the package, and re-install it through the package, the file won't open. I tracked the success value, and it returns false. The same thing happens when I try to open a file locally, it can be opened from the debug mode, but failed after building to a package.
Anyone has the experience to resolve it?
Direct file/folder access is restricted in an Windows Store app. it is a sandboxed execution environment. There are designated folders that you can use to create and access files. for anything else you will need end user intervention.
look at classes: StorageFolder::GetFileAsync, StorageFile::OpenAsync and DataReader::LoadAsync.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With