asp.net mvc - The correct way of showing data as HTML -



asp.net mvc - The correct way of showing data as HTML -

i've used asp.net mvc5 in project. want show info recorded in database part of html page. simplest info in database recorded, have <div>this div.</div>

and in cshtml file have

<div> @html.displayfor(m => m.description) </div>

but info not show html tag.

how can explain browser info must interpreted html tag?

use @html.raw instead of @html.displayfor.

most of html helper functions in razor automatically encode values help prevent cross-site scripting attacks. if you're going render raw html user's browser hope you've sanitized prevent attacks.

html asp.net-mvc razor asp.net-mvc-5

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -