asp.net 删除图片问题

 
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.csdn.net/u/20080319/16/14d03d7b-b285-4e8a-97ff-d4423f4a775e.html

你可能感兴趣的:(asp.net,Path)