The process cannot access the file because it is being used by another process while deleting image
<p>I am trying to delete original image after thumbnail create but original image cannot be deleted. It throws the exception </p>

<blockquote>
  <p>The process cannot access the file because it is being used by another process.</p>
</blockquote>

<p>Here is my code </p>

<pre><code>public static string deleteImage(string imagename,string rootpath)
{
   try
   {
      string completePath = HttpContext.Current.Server.MapPath(rootpath + "Images/") + imagename;
      if (File.Exists(completePath))
      {
         File.Delete(completePath);
      }
   }
   catch (Exception e)
   {
       throw e;
   }
}
</code></pre>

<p>Any idea, I am using Visual Studio 2008, thanks</p>
