1. 程式人生 > >一般處理程序中刪除文件

一般處理程序中刪除文件

sts exe images scalar server quest app content 程序

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);
}

一般處理程序中刪除文件