You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe the problem.
I am trying to use blazor custom elements on the web forms application.
Problem is that in order for the component to work base href has to be set on the page.
Setting the base href messes up the relative navigation and form posts on web forms pages.
Describe the solution you'd like
I would like an option to set the "blazorBase" to be used instead of document.baseURI
Additional context
This is similar request to the one reported here #43191 but for blazor.webassembly.js.
I have a web forms migration POC that seems like acceptable solution to modernize legacy apps and sprinkle some new components to be reused across applications. Here is the repo where I've modified the blazor.webassembly.js to fix custom elements issue relative to base href.
Essentially anywhere where the code is referencing the document.baseURI I've added this (document.blazorBase || document.baseURI)
This is one of the location in the actual source
Thanks for contacting us.
While this may be a great idea, it is not aligned with our long-term vision to make it part of the framework. For many other ideas which don't belong to the framework we encourage the community to build and ship on their own, contributing to the expanding .NET Ecosystem.
You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.
@mkArtakMSFT thank you for taking your time reading my initial request, and I hope that few additional lines will not be too annoying.
The migration guidelines provided by Microsoft are suggesting using yarp and gradually moving pages to blazor.
Thing is that does not help with shared UI concerns (popups, notifications, navigation...) which would need to be maintained in two different code bases.
Having blazor custom elements on WebForms pages helps with modernization and reusability of those common components.
The only thing missing is ability to adjust the root for loading framework files.
I am sorry to hear that Microsoft is not interested to apply this simple tweak, to allow better migration experience for so many web forms projects out there.
Code could be similar to this config for blazor server
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I am trying to use blazor custom elements on the web forms application.
Problem is that in order for the component to work base href has to be set on the page.
Setting the base href messes up the relative navigation and form posts on web forms pages.
Describe the solution you'd like
I would like an option to set the "blazorBase" to be used instead of document.baseURI
Additional context
This is similar request to the one reported here #43191 but for blazor.webassembly.js.
I have a web forms migration POC that seems like acceptable solution to modernize legacy apps and sprinkle some new components to be reused across applications.
Here is the repo where I've modified the blazor.webassembly.js to fix custom elements issue relative to base href.
Essentially anywhere where the code is referencing the document.baseURI I've added this
(document.blazorBase || document.baseURI)
This is one of the location in the actual source
aspnetcore/src/Components/Web.JS/src/JSInitializers/JSInitializers.ts
Line 48 in 8e90749
I've also have a tweak to solve the cache issue using the same blazorBase variable in dotnet.js
https://github.com/dotnet/runtime/blob/85e8f688ffaf02743da29adff95e98ebd22a6f53/src/mono/browser/runtime/loader/assetsCache.ts#L166
const relativeBaseHref = (globalThis.document.blazorBase || globalThis.document.baseURI)...
So instead of this hack it would be nice to have something as part of the Blazor startup configuration.
The text was updated successfully, but these errors were encountered: