views:

57

answers:

2

When I enter the full hard disk path as a parameter of the method Image.Save, I get no error and the file is being saved on the desired location. But I want the image saved inside Web project folder of the application so I use this code:

myImage.Save(Server.MapPath("SomeApp.Web/report.png"), System.Drawing.Imaging.ImageFormat.Png);

and then I get the following error. Logically, this path is OK, so why error?!

PS. myImage is of type System.Drawing.Image.

A: 

You must make sure that the IIS process user has write access to the path in question.

In any case, it must have write access in the normal file system security.

If you use IIS6, you must also set write access to the folder in Internet Information Services. In that case, you should also set Execution rights to None.

If you use IIS7 (or the built-in test server in VS), these settings are contained in web.config, but I think it is enough to set it on the file system. In my experience, I have never needed to set anything special in the IIS7 settings to get this to work.

awe
A: 

SomeApp.Web part of the path wasn't necessary because Server.MapPath was already in that directory. Shame on me to asked this question.

trnTash