In your development career, you will get this error very often and sometimes you may not be able to resolve it. So, in this post, I will tell you how to approach this error.
Resolving "Access Path is Denied" error
First of all, what do you need to check to see if the path has permissions or not? For this, let's see below how you can do this.
- To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties", and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account and check the boxes for the desired access.
You can either add "IISUSERS" or add "EVERYONE" (which is less secure) and give them full rights to remove this error.
- Before opening Visual Studio, right-click on your Visual Studio icon and run it as an administrator. Try again to run your code. If your problem is not resolved, do the following.
- Right-click on your directory that you want to access and select "Properties".
- Select the "Security" tab.
- Click on the "Advanced" button.
- Select the "Owner" tab.
- Select the owner (MACHINENAME\Administrators), check the "Replace owner on subcontainers and objects" and click OK.
So by using these two approaches, you can resolve this access denied error.
Hope this will help you someday!!!