deleting the file (FileInfo) in asp.net
<p>in my page. when i upload image i did image management. after that i want to delete the original image but i am getting error that the file is already using, like below 
<strong>(The process cannot access the file 'D:\sasiweb\myimage\Images\jalsa.jpeg' because it is being used by another process.)</strong></p>

<p>and this is my code</p>

<p>protected void sizeManage(string filename)
    {</p>

<pre><code>    string fn = Server.MapPath("~/Images/" + filename );

    System.Drawing.Bitmap newimg = new System.Drawing.Bitmap(fn);
    int h = newimg.Height;
    int w = newimg.Width;

    if (w &gt; 100)
    {
        objJpeg = new ASPJPEGLib.ASPJpeg();
        objJpeg.Open(Server.MapPath("~/Images/" + FileUpload1.FileName.ToString()));

        int L = 100;
        objJpeg.Width = L;

        objJpeg.Height = objJpeg.OriginalHeight * L / objJpeg.OriginalWidth;
        objJpeg.Save(Server.MapPath("~/Images/" + "small" + FileUpload1.FileName));

        string path = Server.MapPath("~/Images/" + FileUpload1.FileName.ToString());
        FileInfo file = new FileInfo(path);
        file.Delete();


    }
    else
    {

    }


}


protected void Button1_Click(object sender, EventArgs e)
{

    FileUpload1.SaveAs(Server.MapPath("~/Images/" + FileUpload1.FileName.ToString()));
    sizeManage(FileUpload1.FileName.ToString());

}
</code></pre>

<p>i am getting error at file.delete();</p>

<p><strong>(The process cannot access the file 'D:\sasiweb\myimage\Images\jalsa.jpeg' because it is being used by another process.)</strong></p>
