if(System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath(Path)))
{
System.IO.File.Delete(Path);
}
====================================
System.IO.File.Delete(Server.MapPath("~/"+imgPath));
即使图片不存在也不会出错的,所以可以省去判断图片是否存在的语句.
http://topic.youkuaiyun.com/u/20080319/16/14d03d7b-b285-4e8a-97ff-d4423f4a775e.html