acces denied when saving to web directory

Apr 18 2007 7:06 PM
I am building a ASP/ C#.NET website that allowes users to download and upload images.
Recently I have published my website on a server and all works fine except the upload (is the only section where i need the physical path to my image directory).
If a user wants to upload an image I get the acces denied error.

For the moment all I use to save the file to the server is a FileUpload. This is how I use it:

Upload.aspx
.................

<asp:FileUpload ID="fUpImg" runat="server" />
<asp:DropDownList ID="dropListCategory" runat="server" AutoPostBack="False" DataTextField="Name"  DataValueField="Code" Width="227px">

............

Upload.aspx.cs

..................

string imageFolder="Images";
MyImage image= new MyImage()  //custom class
image.Name=fUpImg.PostedFile.FileName;
image.categoryCode=  dropListCategory.SelectedValue;
imagefolderPath=  MapPath(imageFolder + "/" + image.categoryCode);
string
finalPath = imageFolderPath +"/"+ fUpImg.PostedFile.FileName;
if (!File.Exists(finalPath))
{
fUpImg.SaveAs(finalPath);
}

I am new to web programming so I really don't know if i can resove this by changing the code or if the server  where my website is hoasted dosen't allow this kind of uploads.
I would appreciate any help


Answers (1)