title: How to Get the Base Url of a Server-Side Blazor App
body: <p>I have a server-side blazor app and I need to know it's base url (e.g. <code>https://localhost:1234</code> or <code>https://my-host.com/appname</code>).</p>
  
  <p>In a traditional ASP.NET web application, I could inspect the <code>Request</code> property of a controller and retrieve the information from it (there's <code>Scheme</code>, <code>Host</code>, and <code>PathBase</code> for that). But since this is a <em>server-side</em> running Blazor app, there is no <code>Request</code> object (at least in my understanding and except maybe when serving the <code>Index.cshtml</code>).</p>
  
  <p>How can I then know, to which URL my app has been deployed to and is running at?</p>
  
  <p>Ideally, I would already have this information at startup time, so that I can configure my services accordingly.</p>