I\'m really problems when open files stored in my project. I need open some files (pdf, html,...) and ever has the same problem: Value does not fall within the expected
I noticed that I get that error if I use the shash /
in the path to the file. Instead, if I use backslash \
I can get the files.
Try following way:
StorageFile sFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"Assets\Data\htm\" + fileName + ".htm");
var fileStream = await sFile.OpenStreamForReadAsync();
Note that you have to place an @
before the path string to avoid the intepretation of \
as scape character.
You could also get the file stream this way:
var fileStream = File.OpenRead("Assets/Data/htm/" + fileName + ".htm");