Rendering raw/unescaped HTML in Blazor - Gérald Barré

Rendering raw/unescaped HTML in Blazor - Gérald Barré

In this Blazor tutorial, I describe how to render a string that contains HTML elements in an ASP.NET Core Blazor component. Blazor provides the type MarkupString to indicate a string is already HTML encoded.

By default, everything you write in a razor file is escaped to prevent any injection. This is very nice to be safe by default. But there are some use cases where you want to generate an HTML string in the code and render it as-is. For instance, you can convert a markdown string to HTML and render it.

Blazor provides the type MarkupString to indicate a string is already HTML encoded. You can instantiate a MarkupString using a new or an explicit cast:

var html = "<strong>meziantou.net</strong>";

var markupString1 = new MarkupString(html);
var markupString2 = (MarkupString)html;

blazor dotnet html programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire HTML Developers

Still, Searching for your dedicated HTML Development Team? **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")** provides trusted web development services for a unique web page development using HTML5 and CSS. **[Hire HTML...

Modern Web Development with Blazor & .NET 5

Blazor isn't just for new apps! Blazor in .NET 5 is integrated seamlessly with ASP.NET Core to enable modern full stack web development with .NET. In this session we'll show you how you can use Blazor and ASP.NET Core together to add rich client-side interactivity to both new and existing apps. You'll learn how to use Blazor components from your existing MVC views and Razor Pages, handle server-side prerendering, setup authentication & authorization, improve load time performance, and then deploy your app into production.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.

Developer Career Path: To Become a Team Lead or Stay a Developer?

For a developer, becoming a team leader can be a trap or open up opportunities for creating software. Two years ago, when I was a developer, ... by Oleg Sklyarov, Fullstack Developer at Skyeng company

Know Everything About HTML With HTML Experts

HTML Assignment Help Australia @30% OFF from Sample Assignment, with Our Best HTML assignment help experts. Get HTML homework help online at affordable price. 100% Plag free assignment solution.