W
W
WhiteBlackGoose2019-11-07 19:28:41
HTML
WhiteBlackGoose, 2019-11-07 19:28:41

How to send pure html to web core asp dot net?

Good afternoon!
You need to generate a page on the server, now the following code

namespace ascsite.Pages
{
    public class PrjsModel : PageModel
    {
        public string Result { get; set; }
        
        public void OnGet()
        {
            Result = "<b>AA</b>";
        }
    }
}

And in the razor page itself, @Model.Result is written accordingly. The problem is that it will be drawn like this: <b>AA</b>instead AA(since .net converts incomprehensible icons like < into html characters. And I want it to chew pure html). How to show result as parsed html?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WhiteBlackGoose, 2019-11-07
@WhiteBlackGoose

Answered on reddit. Solved like this: @Html.Raw(Model.Result);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question