title: How do I get the Web Root Path and the Content Root Path in ASP.NET Core?
body: <p>I am trying to add a root path as a parameter in a View, so I can pass it as a parameter to a PayPal button. </p>
  
  <pre><code>&lt;form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top"&gt;
      ... snip ...
  
      &lt;input type="hidden" name="return" value="@Model.UrlRoot/Manage/Subscription?userId=@Model.User.Id"&gt;
  
      ... snip ...
  &lt;/form&gt;
  </code></pre>
  
  <p>I was sifting through the answers at 
  <a href="https://stackoverflow.com/questions/1288046/how-can-i-get-my-webapps-base-url-in-asp-net-mvc">How can I get my webapp&#39;s base URL in ASP.NET MVC?</a> (20 answers)
  and
  <a href="https://stackoverflow.com/questions/35082888/asp-net-mvc-6-applications-virtual-application-root-path">ASP.NET MVC 6 application&#39;s virtual application root path</a></p>
  
  <p>Since ASP.NET Core is quite different, the Request class no longer contains a .Url property, so most of those answers don't work. </p>