Blazor WebAssembly component doesn’t load data from WebApi
I created ASP.NET Core MVC .NET 8 application. I added simple WebApi ProductController which returns Json list of products.
Then I added Blazor WebAssembly Standalone app to the solution and included one page from the Blazor app to my ASP.NET Core app. I want to implement rich UI for products with this Blazor component. To get data (products) I call the ProductController with RestSharp component. Then strange happens – the product list refreshed for a second and then disappear. If I try test data (simple mock with list of products) all works fine. I checked the ProductController WebApi it works fine, returns json data.
Please help to fix this.
Blazor Standalone App doesn’t save HTTP request cookies
I got a .NET 8 Blazor WebAssembly Standalone App that talks to a .NET 8 ASP.NET Core Web API. When an API endpoint adds a cookie to the response, there is no Set-Cookie header in the Blazor App response, document.cookie is empty and when calling another endpoint with the same HttpClient on the same page, the API request doesn’t have the cookie either. Yet when looking at the browser (Edge) inspect Network tab, the response has a Set-Cookie header with the right cookie.
ASP.NET: Serving a WebAssembly application via an ASP.NET server
I have 2 projects. The first one is an ASP.NET webAssembly client web application. When I build the projet and then publish it, I get a wwwroot directory that contains all the file of the web application. This web application connect to a REST API that runs on another ASP.NET server project. I would like that my REST server also serve the client web pages. I have modify my Main with the following code:
app.UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider(serverRoot), });
When I try to open the client in Firefox, the browser try to load the file icudt_EFIGS.dat and get an error 404 (the file exists in the wwwroot directory). I have tried to serve the web application with another Static File Server, and the file icudt_EFIGS.dat is never requested by the browser… The same is true when I am debuging the application via Visual Studio and IIS Express is used.
I have tried to add a web.config file to allow the .dat files to be serve by the file Server, it has not work.