title: Map the physical file path in asp.net mvc
body: <p>I am trying to read an XSLT file from disk in my ASP.Net MVC controller. What I am doing is the following:</p>
  
  <pre><code>string filepath = HttpContext.Request.PhysicalApplicationPath;
  filepath += "/Content/Xsl/pubmed.xslt";
  string xsl = System.IO.File.ReadAllText(filepath);
  </code></pre>
  
  <p>However, <a href="http://forums.asp.net/t/1201036.aspx" rel="noreferrer">half way down this thread on forums.asp.net</a> there is the following quote</p>
  
  <blockquote>
    <p>HttpContext.Current is evil and if you
    use it anywhere in your mvc app you
    are doing something wrong because you
    do not need it.</p>
  </blockquote>
  
  <p>Whilst I am not using <code>Current</code>, I am wondering what is the best way to determine the absolute physical path of a file in MVC? For some reason (I don't know why!) <code>HttpContext</code> doesn't feel right for me. </p>
  
  <p>Is there a better (or recommended/best practice) way of reading files from disk in ASP.Net MVC?</p>