一般处理程序中删除文件

int id = Convert.ToInt32(context.Request["id"]);
string sql = "select ImgUrl from Contents where ID=" + id;
string url = (string)SqlHelper.ExecuteScalar(sql);
string path = System.Web.HttpContext.Current.Server.MapPath("images/img/");
url = path + url;
if (File.Exists(url))
{
File.Delete(url);
}

原文地址:https://www.cnblogs.com/wz9003/p/7052524.html