public static void updatepicture(int pid, string picture, string old) { if (HttpContext.Current.Session["Type"].ToString().ToLower().Equals("admin")) { if (!picture.Contains(@"img/pic.jpg") && !picture.Contains("facebook")) { System.IO.File.Delete(HttpRuntime.AppDomainAppPath + "/" + old); } myDAL obj = new myDAL(); obj.updatepicture(pid, picture); } }