title: File is being used by another process .NET
body: <p>I need to create/append a text file and write some data in that. When I write the below code to my ASP.NET application, it gives the error that file is being used by another process.</p>
  
  <pre><code>if (!File.Exists(path\file))
      File.CreateText(path\file);
  using(StreamWriter sw = File.AppendText(Server.MapPath(path\file)))
  {
      sw.WriteLine("Text Data");
      sw.Close();
  }
  </code></pre>