Wednesday, November 24, 2010

Razor outputting raw unescaped HTML.. ASP.Net MVC3

In general I love the look and feel of the new Razor View Engine - works really well.

However if you ever want to output raw HTML then it's a bit ugly - e.g. to output some JSON I did:

var currentConnectionStrings = @(new HtmlString(Json.Encode(Model.ConnectionStrings)));

It would be nice if this instead did something like @=Json.Encode(Model.ConnectionStrings) - or some other "special" character combination

No comments:

Post a Comment