I encountered this error while i was creating charts in asp.net using C#. The charts used to work fine in visual studio but when i published the website and tried to access the site through localhost (http://localhost/mysite/charts.aspx) it gave me this error. I’ll cut the crap and come straight to the point. The error was caused because ASP.NET machine user have no write permissions where my charts control wanted to create images.  I am using windows xp. I was looking for a way to give write permission to asp.net machine user on the charts folder in my website but there were no such options available in xp. To enable these option go to “tools” than to “folder options”  than click on the “view” tab. Now scroll down and uncheck “use simple file sharing”.

Uncheck "Use simple file sharing"

After this right click on ur charts folder where the images are supposed to be saved. Click on properties. Click on security tab. Add ASP.NET machine account user and give full rights.

Add ASP.NET mahine account user and give full rights

Click ok and check your published website charts. It will work fine. The next problem that I encountered was when I was trying to publish the same website on our Server machine running Windows Server 2003 to make it accessable through live ip. I repeated the above process and gave “ASP.NET machine account” user full rights but still the charts didn’t worked. The problem was solved by giving “Users” account write permission in addition to the ASP.NET machine user account on the charts folder on the server machine.