Blazor is a .NET framework used to build seamless single-page applications using C# and HTML practices. Take a deep dive on what actually is an SPA and how WebAssembly is used to display the content on the browser. Moreover, understand the difference between ASP.NET and .NET technology.
2. BEFO RE W E BE GIN
We must understand the following as well:
o ASP.NET v/s .NET
o Single Page Application
o WebAssembly (WASM)
o Server-side Model
Let's dive into it step-by-step
3. . N E T
o It’s a cross-platform, open-source developer platform for building many
different types of applications
o You can write .NET in various languages including C#, F#, or Visual Basic
o It consists of NuGet, a package manager built specifically for .NET which
consists of over 100,000 packages.
o Not only this, but you can also join .NET developers' community on multiple
social media platforms
o Latest version of .NET is currently .NET 8.0.
5. ASP. NET
o It’s a cross-platform, open-source and a free framework specifically used to
build web-apps and services with .NET and C#
o It extends the .NET developer platform with tools and libraries which are used
specific to web applications.
6. SING LE P AGE APPL ICAT ION
(SPA )
o Refers to the web app implementation that only loads a single web
document
o The single web document then updates the content of that single
document via JavaScript APIs such as Fetch when different content is
to be shown
o Allows user to use website without loading new pages from the server,
resulting in performance gains and a more dynamic experience
7. SING LE P AGE APPL ICAT ION
(SPA )
o Websites such as Gmail, Facebook, LinkedIn etc., all are SPAs that offers
outstanding user experience in the browser with no page reloading
8. SING LE P AGE APPL ICAT ION
(SPA )
o In general, when you want to visit a specific web page, you enter its
address to request access from the browser, the browser sends this
request to a server, and it comes with an HTML document in return
o Using SPA, the server sends the HTML document only for the first
request, sending JSON data
o The SPA will rewrite the current page’s content and not reload the
whole web page
9. SING LE P AGE APPL ICAT ION
(SPA ) ( A D V A N T A G E S )
o High Speed: SPAs provide shorter response times as the entire page doesn’t have to reload
and the data only changes in the requested content path
o Enhanced UX: Helps user gain only the information they request other than loading
everything
o Efficient Caching: Caches data efficiently as it sends a request to a server for one time only
and then updates the other data
o Consumes less resources: Since they load the page just once, therefore it consumes less
bandwidth, and work in areas with slow internet
o Cross platform compatibility: Help developers make apps that can run on any OS, device
and browser
10. SING LE P AGE APPL ICAT ION
(SPA ) ( D I S A D V A N T A G E S )
o Poor SEO performance: As there is just a single URL with no changes or exceptional addresses,
optimizing it for SEO is tricky. It lacks indexation, good analytics, unique links, metadata, etc.
o Online threats: SPAs are more vulnerable to online threats such as cross-site scripting (XSS) than
MPAs. Attackers can utilize XSS to inject client-side scripts into a web app and compromise it.
o Initial load time: Although SPAs are praised for showcasing great performance and speed, it takes
a while to load the complete site. It may irritate some users who may not open the app again.
o Doesn’t store history: SPAs don’t store browser history. If you check the history for any valuable
data, you only see the SPA’s link to the entire website. Also, you can’t move back and forth in the
SPA.
11. WEB ASSE MBLY
o Web Assembly allows you to take
the parsing and compiling to the
server
o With Web Assembly, you compile
your code in WASM, from where it
gets downloaded by the browser
12. WEB ASSE MBLY
o WebAssembly allows you to run
.NET code in your browser
o This is how you run Blazor on web.
Blazor uses ASP.NET MVC approach
for building applications that run in
the browser
13. SERV ER - S IDE MODE L
o Results in smaller size downloads
14. BLAZ OR
o An ASP.NET framework used to
make Single Page Applications
o Consists of Razor pages in which
user can write code and markup at
the same place
o Fast, scalable and accurate
o Can run on both client and server
models efficiently