title: Is there any reason not to use absolute paths in asp.net MVC?
body: <p>All of the built-in framework methods in MVC, like <code>Url.Action</code> or <code>Url.Content</code> produce only relative urls in the resulting html. Lots of SO answers have provided ways to get the absolute path. <a href="https://stackoverflow.com/questions/5539156/how-to-generate-absolute-urls-with-https-in-mvc3">For example</a>:</p>
  <pre><code>using System;
  using System.Web;
  using System.Web.Mvc;
  
  public static class UrlExtensions
  {
      public static string Content(this UrlHelper urlHelper, string contentPath, bool toAbsolute = false)
      {
          var path = urlHelper.Content(contentPath);
          var url = new Uri(HttpContext.Current.Request.Url, path);
  
          return toAbsolute ? url.AbsoluteUri : path;
      }
  }
  </code></pre>
  <p>works for me.</p>
  <p>My question is, is there ever a reason not to use the absolute path? It is strictly better in terms of making your site more open to web scraping, accessibility tools, RSS feeds etc. Is there a down side? Seems like the absolute path should be default and the relative path should be the custom implementation.</p>