Securing Blazor WebAssembly
In the previous editions of this book, we built two versions of the blog, one for Blazor Server and one for Blazor WebAssembly. In this edition, the whole point is that we don’t have to choose one over the other. As previously mentioned, there are two projects, BlazorWebApp
and BlazorWebApp.Client
. In the client project, we add all the components we want to be able to run as WebAssembly. Here is the really cool part. We have our TagList
component in the client project. If we are running it as InteractiveAuto, it will first render on the server using SignalR using the configuration found in the BlazorWebApp
project. But the next time the site runs, it will load the WebAssembly version and use the configuration in the BlazorWebApp.Client
project. So, the same component can use a different dependency injection. In one case, it will use direct data access, and in the other, it will use the API client we created in the previous chapter.
For us to...