title: Deleting a file in C#
body: <p>Seems like it should a really easy topic, all the examples everywhere are just a couple of lines however no decent explainations, and thus I keep running into the same error without a solution. </p>
  
  <p>In short this part of the applicaion runs like so</p>
  
  <ol>
  <li>Pulls images from db</li>
  <li>Creates actual images files in a temp folder</li>
  <li>creates pdf with images inside of it</li>
  <li>now delete images that were created.</li>
  </ol>
  
  <p>Everything works up until the delete. I keep getting the error</p>
  
  <blockquote>
    <p><strong>InnerException:</strong><br />System.ArgumentException: URI formats are not supported.
       at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)...</p>
  </blockquote>
  
  <p>I have tried a couple different ways to accomplish the delete the latest being:</p>
  
  <pre><code>foreach (string item in TempFilesList)
      {
          path = System.Web.HttpContext.Current.Application["baseWebDomainUrl"] + "/temp/" + item;
          fileDel = new FileInfo(path);
          fileDel.Delete();
      }
  </code></pre>
  
  <p>and the try before that one was:</p>
  
  <pre><code>foreach (string item in TempFilesList)
      {
          File.Delete(System.Web.HttpContext.Current.Application["baseWebDomainUrl"] + "/temp/" + item);
      }
  </code></pre>
  
  <p>TempFilesList is an array list containing the paths to the images to delete.</p>