title: MapPath vs VirtualPathUtility.ToAbsolute
body: <p>I am using c#, asp.net and working on a web application.  </p>
  
  <p>I initially had a relative path as such which I needed to be an absolute path.
  The below works but need to get the absolute path:</p>
  
  <pre><code>    return Chart.RenderChartHTML("../../Charts/MSLine.swf");
  </code></pre>
  
  <p>I tried the following which didn't work (note that it gives me the complete path on my hard drive to .swf):</p>
  
  <pre><code>    string mslinepath = HttpContext.Current.Server.MapPath("Charts/MSLine.swf");
  
      return Chart.RenderChartHTML(mslinepath);
  </code></pre>
  
  <p>I then tried the following which works:</p>
  
  <pre><code>    string mslinepath = VirtualPathUtility.ToAbsolute("~/Charts/MSLine.swf");
  
      return Chart.RenderChartHTML(mslinepath);
  </code></pre>
  
  <p>Wondering why VirtualPathUtility.ToAbsolute works while the other one doesn't.  </p>