0
--code behind--否認訪問路徑,並同時上傳照片到網上數據庫
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(Server.MapPath("Uploads\\" + FileUpload1.FileName));
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please Upload a Photo')", true);
}
string path = "Uploads\\" + FileUpload1.FileName.ToString();
string ins=insert into tbl(image)values('"+path+"');
con.Open();
cmd = new SqlCommand(ins, con);
int row = cmd.ExecuteNonQuery();
if (row > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Thank You For Registering With Us..Press Cancel To Continue!!')", true);
}
con.Close();
--source error--
異常詳細信息:System.UnauthorizedAccessException:對路徑「C: \ HostingSpaces \ acquircom \ acquirosoft.com \ wwwroot \ Deepam \ Uploads \ actiiv_fitband_003.png'被拒絕。
您需要「上傳」文件夾的寫入權限。確保您僅爲每個IIS版本的iis用戶授予權限,不要向每個人授予權限。 –