Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access to the path is denied
#1
Deleting files using the built-in functions in C# throws an error, but using the LA function deletes them successfully. Why?

System.UnauthorizedAccessException: Access to the path 'C:\Users\Administrator\Desktop\240402_105050.dat' is denied.
   at line 5 in Script2.cs
   >>
   --- Raw stack trace ---
   at System.IO.FileSystem.DeleteFile(String fullPath)
   at Program.<Main>$(String[] args) in C:\Users\Administrator\Documents\LibreAutomate\Main\files\Script2.cs:line 5



Code:
Copy      Help
//.
script.setup(trayIcon: true, sleepExit: true);
//..

File.Delete(@"C:\Users\Administrator\Desktop\240402_105050.dat"); //NO
//filesystem.delete(@"C:\Users\Administrator\Desktop\240402_105050.dat"); //OK


Messages In This Thread
Access to the path is denied - by Davider - 04-02-2024, 03:08 AM
RE: Access to the path is denied - by Gintaras - 04-02-2024, 04:36 AM
RE: Access to the path is denied - by Davider - 04-02-2024, 05:52 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)