I am trying to reading a .txt file of C or D drive in a UWP application. It is ok, when I declare the local variable for file name in assets. But it\'s filed to read file from o
You're getting this exception because UWP is sandboxed and you don't have permission to access that location by default. See here for a full list of locations that you are able to access by default.
If you absolutely need higher level access to more locations then your only option is to use broadFileSystemAccess
(which is also referenced in the above link). This will be a fine option if you're sideloading, but if you're uploading the the app store then you're likely going to run into a tonne of issues.
Conclusion: It depends entirely on what your needs are but if the file is only going to be read/written by your app then the best option would be to copy it to your apps LocalFolder
.