title: ASP.NET Get physical filepath from URL
body: <p>Is there a way to get the physical filepath from an ASP.NET's URL?</p>
  
  <p>Scenerio: I have an app that is on two severs, but it will now be on lots more, and each server puts it in a different physical file path. Right now I'm doing this: </p>
  
  <pre><code>//for server 1
  if (Request.Url.GetLeftPart(UriPartial.Path).Contains(".com"))
   { Application["StoreFilesPath"] = "E:\\Data\\rootsite\\f1\\appsite\\Upload\\"; }
  
  //for server 2
  if (Request.Url.GetLeftPart(UriPartial.Path).Contains(".net"))
   { Application["StoreFilesPath"] = "E:\\Web\\rootsite2\\f34\\abc\\ghi\\appsite\\Upload\\"; }
  </code></pre>
  
  <p>But what I need to do is something like this:</p>
  
  <pre><code>//for all servers
  Application["StoreFilesPath"] = getPhysicalFilePath() +"\\Upload\\";
  </code></pre>
  
  <p>How can I do it?</p>