Getting Access Denied on reading and writing txt file from Root Folder

269 Views Asked by At

I am trying to read .txt file in Maui Program from the location which I am getting from Path.GetPathRoot(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal));

I am getting access denied error.

What permissions have to give to the windows application.

1

There are 1 best solutions below

0
On

Reading system root files requires administrator privileges

  1. Run Visual Studio as administrator.

  2. In solution explorer, add new item, select "Application Manifest File".

change

 <requestedExecutionLevel level="asInvoker" uiAccess="false" />

to

 <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />