Thursday, September 17, 2009

System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\...' is denied

This exception is a very common exception. It usually occurs when we move our application to IIS server.

This exception occurs because IIS uses ASP .Net (IIS_IUser in Vista) user account and ASP .Net is not authorized to access that location.

To give a quick fix to this, follow these steps:-

1-Give read/write rights to ASP.NET user to C:\Inetpub\yourfolder\ folder:-

1- Right Click on Folder and Select Properties
2- Go to Security Tab
3- Click Add, then click Location.
4- Select your pc name, usually first item.
5- Press Ok, then press advance and then Find Now.
6- Select ASP.NET user if not exist then select Authenticated Users.
7- Press Ok. And Select Read/Write/Modify/List Folder Contents

2- Go to IIS->WebSites->DefaultWebSite->YourWebSiteName->Properties, and at Virtual Directory Tab check 'Read' and 'Write' button.

No comments:

Shared Button