During the past years, Microsoft introduced different web-based frameworks related to web development, like Asp.Net MVC, Asp.Net Web Page, and, most recently, Asp.Net Core. With the introduction of each new framework, there are a few predictions related to the discontinuation of the Asp.Net Web Forms as an outdated framework. But still, now, developers continue to work with the Asp.Net Web Forms as it is much simpler, more stable, and more productive than the other framework. Still today, around half a million web developers used Asp.Net WebForms. In 2018, Microsoft introduced a new web-based framework called Blazor.
What is Web Assembly?
WebAssembly is treated as a low-level-based assembly language for any platform. Therefore, Web Assembly is also known as a web standard. With the help of WebAssembly, we can execute the web page's code at the same speed, just like native machine code. Generally, the high-level language used to develop the web application is converted into WebAssembly and then runs like a native code speed in the browser. Due to this breaking achievement in web development, we can now use conventional server-side languages like C# and F# to develop any web application which can be run into the browser directly.
Nowadays, all the modern browser versions are supported the WebAssembly. But the question is, what will happen if someone uses the old version of browsers or old phones? WebAssembly will take care of this scenario by itself. In the case of old browsers, WebAssembly internally fallback to JavaScript and run the application without any hitch. WebAssembly is also open-source, so anybody can easily debug the code into the web platform. WebAssembly is generally abbreviated as wasm. Also, most importantly, Blazor does not require installing the .Net framework in the client machine to run the WebAssembly.
In the case of Blazor, we can use the Blazor WebAssembly App to run the application on the client side. As we know, WebAssembly or wasm contains the instruction in a binary format that the browsers can execute. In the case of Blazor, this conversion means from high-level language to binary format instruction is done with the help of Mono runtime. WebAssembly is represented as a textual assembly language that supports compact binary format data. With this help, it provides near-native fast performance with fast download of the application. With the help of WebAssembly, we can also develop a progressive web application that can be downloaded and run offline at the user's end. Below is the list of browsers with a version of the WebAssembly.
About Blazor Web Assembly
Microsoft introduced Blazor WebAssembly Hosting Model in May 2020. Blazor WebAssembly or Blazor – WASM-based application mainly runs on the client-side browser with the help of WebAssembly-based .NET runtime. While we access the web application in the browser, the Blazor app, its related dependencies, and the .Net runtime libraries are downloaded in the browser at the client side machine. The application is always executed on the browser using the UI thread and handles the event-related processes. In the Blazor Web-Assembly application, application assets like CSS, js, image files, etc., are considered static files in the web server part. Therefore, we can create the Blazor WebAssembly app in two different ways. If we make the application without the support of the Asp.Net Core back-end app for its server-type files, then that application is treated as a standalone Blazor WebAssembly app. On the other hand, when we create the application with the back-end app options to serve its server-side files, it is treated as a hosted Blazor WebAssembly app.

In the case of a Blazor WebAssembly app, we can develop it as a Progressive Web App (PWA) to use the support of the modern browser API. So that we can enable different functionality of a native client app like offline work, running the application on its separate window, enabling push notifications, and automatic version updates as a background process. With the help of Blazor WebAssembly, we can use the full-stack web development process with .Net Core. In the process, we can use the same code between the client and server application and perform integration with MVC and Razor pages. While we hosted the client app on a server, the client app can communicate with the back-end server application with the help of different protocols or messaging frameworks like Web API, SignalR, and gRPC-Web.
We can achieve several benefits while we use the Blazor WebAssembly (wasm) hosting model like –
- In the case of Blazor WebAssembly, there is no dependency once the app is downloaded into the client machine from the server. So, if the server goes offline, the app will continue working.
- The Asp.Net Core web server is not necessarily required to host the application. Instead, we can use the serverless deployment mechanism like CDN to host the application.
- We can use the client's resources and capabilities fully.
- Despite the above benefits, the Blazor WebAssembly app also has some limitations like –
- The application is dependent on the capability of the browser.
- For the first time, when the application is opened in the client browser, it downloads the entire app-related resources along with runtime libraries and dependencies.
- So, based on the application size, it can take longer to load the application for the first time.
As the application entirely depends on the client's machine, proper software and hardware configuration are required for the client's machine.
Develop the Blazor Web Assembly App
Step 1. First, open Microsoft Visual Studio 2022 and click Create a New Project.
Step 2. Now select the Blazor WebAssembly App option and click on the Next Button.

Step 3. In the Next window, provide the Project name and click the Next Button.

Step 4. Now, select the Framework version as .Net7 and then click on the create button.

Step 5. For the client app, we will create one Product related shopping cart-related UI.
Step 6. For that purpose, Add the new class called Product.cs under the blazor_wasm_static_app.Shared projects.
public class Product
{
public string ProductCode { get; set; }
public string ProductName { get; set; }
public string Description { get; set; }
public string Manufacturer { get; set; }
public string ProductImage { get; set; }
public decimal Price { get; set; }
}
Step 7. Now, add a products.json file under the wwwroot data folder, and in that particular file, add some JSON formatted data based on the Product model class.
Step 8. Now, select the Pages folder and add a new component called CardComponent.razor and add the below code into that file –











Join the conversation! Your thoughts help the community grow.