本文介绍了访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将图片上传到网络服务器,我写了以下代码



I am uploading picture to webserver, and i have written the following code

protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            try
            {
                string filename = Path.GetFileName(FileUpload1.FileName);
                Response.Write(filename);
                FileUpload1.SaveAs(Server.MapPath("~/AddImage/") + filename);
                //StatusLabel.Text = "Upload status: File uploaded!";
                Response.Write("file uploaded");
            }
            catch (Exception ex)
            {
               // StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                Response.Write("File Error:"+ex.Message);
            }
        }









它工作正常,文件正确上传到AddImage文件夹,

但是当我在服务器上运行此代码时,我收到以下错误:

访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。



有什么问题,如何解决?

请帮助






on my local server it is working correctly and file is uploading correctly to AddImage folder,
But when i am running this code on server i am getting following error:
Access to the path 'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg' is denied.

What is the problem and how can i fix it???
pls help

推荐答案


这篇关于访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 22:01