title: How to embed and use Blazor WebAssembly in Web Forms?
body: <p>Have a Web Forms app that I would like to gradually port, on a page by page basis, to Blazor WebAssembly by embedding Blazor into Web Form pages the way it is possible with Angular.</p>
  <p>Published the Blazor app to the Web Forms project under a subdirectory called &quot;Blazor&quot;. If I run the Web Forms app and hit http://localhost:1234/Blazor the Blazor app runs fine (after editing the Blazor index.html =&gt; <code>&lt;base href=&quot;/Blazor/&quot; /&gt;</code>). However, when I try to embed Blazor in a Web Form page it doesn't work. The web form page asp:content contains what the Blazor index.html page contains:</p>
  <pre><code>&lt;%@ Page Title=&quot;EmbedTest&quot; Language=&quot;C#&quot; MasterPageFile=&quot;~/Site.Master&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;EmbedTest.aspx.cs&quot; Inherits=&quot;WebFormBlazor.EmbedTest&quot; %&gt;
  
  &lt;asp:Content ID=&quot;BodyContent&quot; ContentPlaceHolderID=&quot;MainContent&quot; runat=&quot;server&quot;&gt;
      &lt;app&gt;Loading...&lt;/app&gt;
  
      &lt;div id=&quot;blazor-error-ui&quot;&gt;
          An unhandled error has occurred.
          &lt;a href=&quot;&quot; class=&quot;reload&quot;&gt;Reload&lt;/a&gt;
          &lt;a class=&quot;dismiss&quot;&gt;&lt;/a&gt; 
      &lt;/div&gt;
  
      &lt;script src=&quot;/Blazor/wwwroot/_framework/blazor.webassembly.js&quot;&gt;&lt;/script&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  <p>When I go to http://localhost:1234/EmbedTest the page displays:
  Loading...
  An unhandled error has occurred. Reload </p>
  <p>And in the console the following error message:
  Uncaught SyntaxError: Unexpected token '&lt;' blazor.webassembly.js:1</p>
  <p>This approach does work with Angular. What am I missing in trying to do this with Blazor WebAssembly?</p>
  <p><strong>Update:</strong>
  As per Mister Magoo, it was not downloading blazor.webassembly.js but actually downloading the index.html which explains the error message.</p>
  <p>Changed the path in the page from /Blazor/wwwroot/_framework/blazor.webassembly.js to /Blazor/_framework/blazor.webassembly.js in the Web Form page and now downloads the script but experiences new error. Gives 404 Not Found for blazor.boot.json.</p>
  <p>Blazor.webassembly.js doesn't know the base href should be /Blazor/ and tries to fetch blazor.boot.json from localhost:1234/_framework/blazor.boot.json instead of localhost:1234/Blazor/_framework/blazor.boot.json.</p>
  <p>So next issue: How to tell blazor.webassembly.js that its base href should be something other than '/' (in my case '/Blazor/')?</p>