About the Author vii
About the Technical Reviewer ix
Chapter 1: Introduction to Blazor 1
Chapter 2: Razor Syntax and the Basics of Blazor 9
Chapter 3: Blazor Components and Navigation 23
Chapter 4: Blazor Components 37
Chapter 5: Specifics of Different Types of Blazor 51
Chapter 6: Forms in Blazor 73
Chapter 7: General Blazor 91
Chapter 8: Security in Blazor 117
Chapter 9: Practice Tasks for Server Rendering Blazor 129
Chapter 10: Practice Tasks for Client (WebAssembly) Blazor 149
Index 175
Build and develop web applications with Blazor in C#. This new edition not only covers the new structure for the Blazor environment, it also demonstrates the latest features, such as rendering, hosting types, improved security arrangements, and updates the syntax. Two new chapters on Forms and Validation along with Security in Blazor are also added. The code and project layout have been updated in .NET 9 for this new edition.
The book starts with an introduction to Blazor, along with its various categories and its basics and syntax, including Razor syntax implementation. You will go through Blazor navigation and life cycle followed by its components. You will then learn features specific to each Blazor type. You will see how Blazor works with storage, files, and javascript, and you will create a Blazor code library. You will also create web applications in Blazor using practical implementations and real-life scenarios for both the server side and the client side. After reading this book, you will be able to build web applications with Blazor in C#11 and .NET Core 9.0.
Blazor is a web UI framework that allows you to use C# and .NET on the front end. It allows you to develop your front-end logic in a couple of different ways using the C# programming language, which is something that you will explore later in this chapter. Technical aspects aside, think of it this way: in any standard web development project, you would need to have two people, one for the javascript and the other for the back end. Sometimes you also need a designer to work with HTML elements and CSS and do other design-related tasks. The Blazor technology will not remove any dependency for a designer, but it will surely remove the dependency on javascript. However, javascript can still be used with the Blazor technology.