How to stop encoding strings in ASP.NET MVC 3 beta 1?
1 Answer
I assume you mean HTML encoding?
in the comments of this post, it says you can use the helper method Html.Raw
example from that post (Razor views, guessing same for other view engines?)
@{
string content = "<b>Hello World</b>";
}
This is some html: @Html.Raw(content)
another good post about Raw method
http://davidhayden.com/blog/dave/archive/2010/12/27/HtmlRawRazorViewEngine.aspx
8 Comments
Sadegh
Thanks house9 but where Raw() is located? I can't find that! System.Web.WebPages.Html?
house9
I believe it is under System.Web.Mvc.Html - not 100% sure though
Sadegh
Thanks again but still i can't figure it out! Are you have use this before?
house9
also you said you are using MVC 3 beta 1 - you should probably get the latest release - asp.net/mvc/mvc3 (MVC 3 Release Candidate 2)
Sadegh
No, I have found Raw() in System.Web.WebPages.HtmlHelper class, but that is internal.
|