Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I have hosted a website "http://ccub.in .In this site, there is an aspx page named accountopen.I can upload necessary images in that page while running the application in visual studio.But I am getting the following error while trying to do the same online.
Error:Access to the path 'C:\vhosts\ccub.in\httpdocs\com_addressproof\proof.jpg' is denied.

Server side coding for uploading image is:
C#
if (FileUpload1.HasFile)
            {

                string filename = Path.Combine(Server.MapPath("~/com_addressproof"), FileUpload1.FileName);
                serverfile1 = Path.GetFileName(FileUpload1.PostedFile.FileName);
                path1 ="com_addressproof\\" + serverfile1;
                if (File.Exists(filename))
                {
                    lbl_msg.Visible = true;
                    lbl_msg.Text = "The Communication Address Proof file name  already exists. So Please change the file name and then Proceed ! ";
                    return;
                }
                FileUpload1.PostedFile.SaveAs(filename);

            }

Can anyone please suggest me any modifications?
Posted
Updated 6-Jun-12 23:10pm
v2

 
Share this answer
 
You will need to allow write access for the user IUSR_<server_name> (Or related user depending on if you are using anonymous access or impersonation) to the folder.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900