asp.net mvc - I want to store and retrieve html data in mvc by setting validate(false) -
if use @html.raw()
html executing well.. people saying displaying data(html) using @html.raw()
lead xss attacks.
but alternatively don't have choice display html data in mvc... there way achieve this?
<h1 class="art-heading">@html.displayfor(model => model.article_name)</h1> <div> @html.displayfor(model => model.article_content) </div> <section> @html.raw(model.code) </section>
try use: mvchtmlstring here more information class
public mvchtmlstring outputhtml() { return mvchtmlstring.create("<div>my div</div>"); }
then in view:
@outputhtml()
Comments
Post a Comment