File/Image Updation or delete it using C#.Net , Asp.Net
using System.Drawing;
using System.IO;
public void filedel()
{
string path = Server.MapPath(@"images\");
string imgurl = path + "a.jpg";
try
{
FileInfo TheFile = new FileInfo(imgurl);
if (TheFile.Exists)
{
File.Delete(imgurl);
}
else
{
Bitmap bmp = new Bitmap(2, 2);
bmp.Save(imgurl, System.Drawing.Imaging.ImageFormat.Jpeg);
bmp.Dispose();
}
Label1.Text = "Sucess";
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
Thank You
Solution Source :
Source of above code & Detail Description[
^]