title: How do I get the absolute media file path in umbraco using razor?
body: <p>I've tried the following bit of razor code:</p>
  
  <pre><code>@room.Media("summaryImage","umbracoFile")
  </code></pre>
  
  <p>but I get something like <code>~/media/155/lux.jpg</code>, how do I remove the initial <code>~</code> to get a server path ie, <code>/media/155/lux.jpg</code> or <code>http://some_url/media/155/lux.jpg</code>?</p>
  
  <p>EDIT:</p>
  
  <p>I've tried</p>
  
  <pre><code>@{
    dynamic summaryImagePath = room.Media("summaryImage","umbracoFile");
  }
  @Page.ResolveUrl(@summaryImagePath)
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Page.ResolveUrl(@room.Media("summaryImage","umbracoFile"))
  </code></pre>
  
  <p>but I keep getting the error:</p>
  
  <pre><code>Error loading Razor Script Cannot perform runtime binding on a null reference
  </code></pre>
  
  <p>even though <code>@room.Media("summaryImage","umbracoFile")</code> gives <code>~/media/155/lux.jpg</code>.</p>
  
  <p>Any ideas?</p>