This exception is a very common exception. It usually occurs when we move our application to IIS server (usually on production environment).
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:-
- Give read/write rights to ASP.NET user to C:\Inetpub\yourfolder\ folder:-
- Right Click on FOlder and Select Properties
- Go to Security Tab
- Click Add, then click Location.
- Select your pc name, usually first item.
- Press Ok, then press advance and then Find Now.
- Select ASP.NET user if not exist then select Authenticated Users.
- Press Ok. And Select Read/Write/Modify/List Folder Contents.
- Go to IIS->WebSites->DefaultWebSite->YourSiteName->Properties, and at Virtual Directory Tab check 'Read' and 'Write' button.