title: ASP.Net Core Blazor: How to load different _Host.cshtml files based on header value
body: <p>I would like to load a <code>_Host.cshtml</code> file in an ASP.NET Core Blazor project (Server side Blazor) based on a header in the request.</p>
  
  <p>For example:</p>
  
  <p>A client connects to <code>example.com</code> and is redirected to a <code>_Host.cshtml</code> file specific for tenant A.
  Another client connects to <code>test.com</code> and is redirected to a <code>_Host.cshtml</code> file specific for tenant B.</p>
  
  <p>The <code>_Host.cshtml</code> file looks somehow like this:</p>
  
  <pre><code>@page
  
  @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;ProjectName&lt;/title&gt;
      &lt;link rel="icon" type="image/png" sizes="32x32" href="images/tenantA/favicons/favicon-32x32.png"&gt;
      &lt;link rel="icon" type="image/png" sizes="16x16" href="images/tenantA/favicons/favicon-16x16.png"&gt;
  &lt;/head&gt;
  &lt;body class="something"&gt;
      &lt;app&gt;
          @(await Html.RenderComponentAsync&lt;App&gt;(RenderMode.Server))
      &lt;/app&gt;
  
      &lt;script src="_framework/blazor.server.js"&gt;&lt;/script&gt;
      &lt;link href="css/tenantA/site.css" rel="stylesheet" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the <code>_Host.cshtml</code> file, the reference to <code>tenantA</code> needs to be set based on the above tenant selection from the tenant URL like described above. Is this possible and if yes how can this be achieved?</p>