How to Fix It
- Replace
@Model.Propertywith@Html.Raw(Model.Property).
- Wrap the call inside your
divtag like this:<div>@Html.Raw(Model.HtmlProperty)</div>.
- Ensure the data is safe and sanitized before using this method to block bad scripts. [1]
If you'd like, let me know:
- What framework you are using (ASP.NET Core or MVC)
- Where the dynamic data comes from
I can give you a safer way to clean the HTML first.