title: Find Physical Path from Microsoft.Web.Administration and path relative to it's root
body: <p>I want to find the physical path within an IIS website, of a path relative to the root of the website, using Microsoft.Web.Administration .NET assembly. </p>
  
  <p>There doesn't seem to a single method to do this, but I am wondering - is the following procedure the best way?:</p>
  
  <ol>
  <li>Get the
  Microsoft.Web.Administration.Site
  object</li>
  <li>Find the application with
  the longest path which matches the
  beginning of the path relative to
  the root</li>
  <li>Strip the application
  path from the beginning of the path
  relative to the root, giving the
  path relative to the application</li>
  <li>Find the virtual directory within
  this application with the longest
  path which matches the beginning of
  the path relative to the
  application</li>
  <li>Strip the
  application path from the beginning
  of the path relative to the
  application, giving the path
  relative to the virtual directory</li>
  <li>Append the path relative to the
  virtual directory (swapping / for )
  to the physical path of the virtual
  directory to give the physical path
  we want</li>
  </ol>
  
  <p>Lee</p>