Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Encoding Strings - ASP.NET Web Forms VS Razor View Engine

I'm not quite sure how this works yet... trying to find documentation.

In my existing app I've got two different ways of rendering strings in my View

<%: model.something %> <!-- or --> <%= model.something %> 

The first one is html encoded, and the second one is not.

Is there something similarly short in Razor? All I can find is this, which is the encoded version.

@model.something 
like image 303
Chase Florell Avatar asked Nov 13 '10 16:11

Chase Florell


1 Answers

I guess the best approach would be to use the Raw extension-method: @Html.Raw(Model.Something)

like image 83
Magnus Avatar answered Sep 22 '22 05:09

Magnus