Unable to access asset files in Metro app

I am trying to read a text file that comes as an asset in a Metro app. I am getting access denied error if I specify the file path as "ms-appx: ///Assets/file.txt". Obviously, I need to install some functionality to access the installation folder. I tried to include all the features in the designer manifest, but still the same error. Please suggest.

+1


source to share


2 answers


Try the following:



StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(
    new Uri("ms-appx:///Assets/file.txt"));
Stream stream = await file.OpenStreamForReadAsync();
StreamReader sr = new StreamReader(stream);

      

+3


source


Is this exactly the link you are using? Try



ms-appx:///Assets/file.txt

      

0


source







All Articles