protected void Delete_Click(object sender, EventArgs e) { int id = int.Parse(Request.QueryString["id"]); //删除原有图片 if (File.Exists("clothes_img/" + id + ".jpg")) { File.Delete("clothes_img/" + id + ".jpg"); } Clothes clothes = new Clothes(); if (clothes.DeleteOne(id)) { Response.Write("<script> alert('删除成功')" + "var domain = 'http://' + window.location.host;" + "window.location.href = domain + '/addone.aspx';"); } }