1

We are in the process of building a Blazor.Net5 server application alongside a number of existing web projects (Blazor, Angular, html etc). We would like the Blazor application to be the only application the users go to and access the other sites from it.

I wanted to create a Blazor component supplied with a local address which then displays the site in question. I think this is possible but not sure how.

I could use iframes I guess but it seems like using ancient technology in a modern framework. I know this is not a key use case for Blazor, but I'd like to push the boundaries.

Does anyone have any ideas?

James Drinkwater
  • 396
  • 5
  • 19
  • 1
    This isn't pushing any boundaries, when the term `portal` was coined in the 2000s it was mainly to create one site to combine other one-off sites. You'll find a *lot* of techniques if you google for `composite UI` or `micro frontends`. Of course, it's a lot easier to compose sites and applications that were built for composition. Check [Creating composite UI based on microservices](https://learn.microsoft.com/en-us/dotnet/architecture/microservices/architect-microservice-container-applications/microservice-based-composite-ui-shape-layout). – Panagiotis Kanavos Jan 22 '21 at 09:21
  • Blazor is an SPA technology, so what you actually ask is how to create a composite SPA. IFRAMEs are a valid choice, since they isolate each SPA's HTML/Javascript from the rest. It's also possible to inject each web site's output into tags. Of course, it's a *lot* easier if the components are purpose-built for composition. In ASP.NET features like View Components, Razor Components and even partial views can be used – Panagiotis Kanavos Jan 22 '21 at 09:31
  • Specifically for ASP.NET MVC and Blazor, check [Supporting Micro-frontends with ASP.NET Core MVC](https://devblogs.microsoft.com/premier-developer/supporting-micro-frontends-with-asp-net-core-mvc/), [Microfrontends with Blazor](https://channel9.msdn.com/Events/dotnetConf/2020/Microfrontends-with-Blazor-Welcome-to-the-Party), [Microfrontends with Blazor WASM](https://medium.com/@waelkdouh/microfrontends-with-blazor-webassembly-b25e4ba3f325) – Panagiotis Kanavos Jan 22 '21 at 09:33
  • Adding to the comments above, there's nothing wrong with properly used iframes. That's exactly how Microsoft 365 is implementing add-ins too. But be aware of their limitations, such as sandboxes and some auth mechanisms not allowing themselves to be framed. – Nikki9696 Jan 22 '21 at 18:44

1 Answers1

0

I think you should have a look at MicroFrontends in Blazor. I wrote an extensive guide on how to implement it with JavaScript frameworks (with React.Js as an example). Here is the link to the guide: https://dev.to/xanderselorm/introduction-to-micro-frontends-using-net-blazor-wasm-part-1-lc9

Xander Selorm
  • 558
  • 6
  • 18