When I run my c# windows form app it response the follwing error
System.UnauthorizedAccessException: 'Access to the path 'C:\Users\My PC\Desktop\VERS backup\VERS\bin\Debug\Result.docx' is denied.'
When I run my c# windows form app it response the follwing error
System.UnauthorizedAccessException: 'Access to the path 'C:\Users\My PC\Desktop\VERS backup\VERS\bin\Debug\Result.docx' is denied.'
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Naimish MakwanaRank #324 · 7.7K reputationPosted Feb 13, 2023, 10:17 AM EST
Hello NURU,
Please check below things. Beacuse An
UnauthorizedAccessException'ssome possible reasons areThe file is being used by another process: The file you are trying to access may be open in another application or process, preventing access.
The caller does not have the required permission.
Anti-virus software: Anti-virus software can block the access to a file for security reasons.
Try to move your code from C: drive to some other drive.
Thanks
Naimish Makwana
Jignesh KumarRank #91 · 22.9K reputationPosted Feb 13, 2023, 11:57 PM EST
Hello Nuru,
User does not have permission. There are two solution for this one,
Rajat JaiswalRank #418 · 5.9K reputationPosted Feb 13, 2023, 10:08 AM EST
Hi,
You can choose a different path or give permission for the file .