title: process cannot access the file because it is being used by another process
body: <p>I am using ASP.NET Webforms with C#. On one page I click submit to create a file on the server.</p>
  
  <pre><code>File.Create(Server.MapPath(ConfigurationManager.AppSettings["LandingPages"])
              + landingPage.FriendlyName);
  </code></pre>
  
  <p>This works fine and creates the file as expected. However, after it does this it redirects to another page, which reads the file that was just created.</p>
  
  <pre><code>var landingPageContent 
         = File.ReadAllText(Server.MapPath(ConfigurationManager.AppSettings["LandingPages"]) 
                            + landingPage.FriendlyName);
  </code></pre>
  
  <p>That's when I get this error.</p>
  
  <blockquote>
    <p>The process cannot access the file 'c:\code\Content\CMS\LandingPages\Test2' because it is being used by another process.</p>
  </blockquote>
  
  <p>If I restart IIS then the process releases the file and I can load that page and read the file just fine. Is there something I need to do after <code>File.Create</code> in order to close the file before the redirect?</p>