要把图片上传到“C:\Inetpub\wwwroot\nutide\images\pics\”目录下,失败,显示 对路径“C:\Inetpub\wwwroot\nutide\images\pics\圣诞5.gif”的访问被拒绝。什么原因?我特意在IIS里将 pics目录设为可写入,还是不行。代码如下
private void Button2_Click(object sender, System.EventArgs e)
{
//图片上传
string filePath = "", fileExtName = "", mFileName="", mPath="";
System.Text.StringBuilder strMsg = new System.Text.StringBuilder("上传文件信息;<hr color=red>");
if(""!=fileUp.PostedFile.FileName)
{ filePath = fileUp.PostedFile.FileName;                        //客户端文件路径及文件名
fileExtName = filePath.Substring(filePath.LastIndexOf(".")+1);   //获取图片文件扩展名
try
{
mPath = Server.MapPath("images/pics/");   //MapPath方法:将虚拟路径映射到服务器上的物理路径
mFileName = filePath.Substring(filePath.LastIndexOf("\\") + 1);   //上传文件的文件名
fileUp.PostedFile.SaveAs(mPath + mFileName);
}
catch (Exception err)
{
Response.Write(err.ToString());
}
}
}