Wix Router pageId Error When Embedding Wix in ASP.NET

I am experiencing an issue while embedding a Wix site into my ASP.NET Core application. The problem occurs when loading the Wix site inside my app, where the following error is thrown in the browser console:
Uncaught (in promise) Error: did not find the pageId for the requested url /

Issue Details:

  • The error originates from pageJsonFileNameMiddleware.ts, indicating that Wix cannot resolve a valid pageId for the requested URL.
  • I am dynamically fetching the Wix page using an HTTP client in ASP.NET and rendering it inside my application.
  • I manually appended the pageId to the request URL, but the issue persists.
  • Wix scripts (thunderbolt.js, wix-router.js) are properly loading, yet the error still occurs.

Steps I Have Tried:

:white_check_mark: Ensured Wix scripts are loading correctly by checking window.__WIX__ in DevTools.
:white_check_mark: Manually forced Wix to navigate to a valid page using WixRouter.navigate("/home").
:white_check_mark: Checked CORS & CSP policies to ensure Wix scripts are not blocked.
:white_check_mark: Appended pageId manually in the request URL, but Wix still fails to detect it.

Wix sites aren’t designed to be embedded inside other applications due to CORS restrictions and script dependencies, which can cause errors like missing pageId. Since thunderbolt.js and wix-router.js are loading but still failing, try using an iframe with the full Wix site URL instead of dynamically fetching and rendering the HTML. If embedding is a must, consider using Wix’s Embed API or Wix Headless to fetch and display data without breaking scripts.