Hello @tim ,
Welcome to Microsoft Q&A!
trying to read an encrypted file using the following: and getting access not allowed error.
UWP runs in a sandbox, by default UWP cannot access files in this location(C:\vbscripts\pid.txt). If you want to continue to access files directly through the path, you need to declare restricted capabilities for this, and open file permission in Settings. Or use the Windows.Storage.FileIO.ReadBufferAsync.
var picker = new Windows.Storage.Pickers.FileOpenPicker();
picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
picker.FileTypeFilter.Add(".txt");
Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
var buffer = await Windows.Storage.FileIO.ReadBufferAsync(file);
byte[] readText = buffer.ToArray();
foreach (byte s in readText)
{
}
}
the following allowed access to "pid.txt" but was was not returning the Char only Diamonds with "?"'s
This problem may be related to StreamReader reading. It is recommended that you refer to the sample reading file in the official documentation.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.