Save HTML tags on sql server and read them


When I save some line break tags in a text on the sql server, that parameter I read it through a service and I save it in a ViewBag.

When displaying it in HTML, the text is shown with the tags.

For example:

Hola esto es un texto <br /> de muestra.

How do I get HTML to interpret these tags? Not as text but as a code.

asked by afar1793 10.10.2017 в 16:45

1 answer


You must use Html.Raw , it works so that the Engine of MVC does not apply transformation to the text. In this link is the method information

answered by 10.10.2017 / 17:08