谁能帮我看下这个错误,谢谢
protected void btn_Ok_Click(object sender, EventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox cka = (CheckBox)GridView1.Rows[i].FindControl("chkid");
if (cka.Checked)
{
int id = Convert.ToInt32(GridView1.DataKeys[i].Value.ToString());
string strsql = "delete from orders where id='" + id + "'";
string strsql123 = "select pdfPath from orders where id ='" +id+ "'";
DataRow drw = DBFun.GetDataRow(strsql123);
string filename = drw["pdfPath"].ToString();
string path = Server.MapPath("..//uploadpic//" + filename);
System.IO.File.Delete(path);
if (DBFun.ExecuteUpdate(strsql))
{
ltl_Msg.Text = "删除成功!";
DataView dvlist = DBFun.GetDataView("select * From orders order by id desc");
AspNetPager1.RecordCount = dvlist.Table.Rows.Count;
Session["dvlist"] = dvlist;
bindData();
}
}
}
}
是循环删除后台上传文件和记录的一个代码,但是报下面这个错误,

[解决办法]
删除要写物理路径而且是绝对路径,且有权限
如:这样删除可以File.Delete(@"d:\web\a.txt");
这样删除不可以File.Delete(@"http://.../web/a.txt");
你这样删除虚拟路径,肯定不行啊