title: read/write operation to text file from asp.net application
body: <p>I am trying to read/write to text file located at the root of my website. I am using asp.net development server (my local machine).</p>
  
  <p>When I read the file it's throwing this exception</p>
  
  <pre><code>Access to the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\error.txt' is denied.
  </code></pre>
  
  <p>I am using following lines of code to read/write from text file</p>
  
  <pre><code> var text = File.ReadAllText(Server.MapPath("error.txt"));
      File.WriteAllText(@"error.txt", text + " \n " + "newnewnew text");
  </code></pre>
  
  <p>What is the problem, why my server.MapPath retrieving path of my c drive? When it should retrieve absolute path of my site, that is</p>
  
  <pre><code>website1/error.txt
  </code></pre>