3

How to stop encoding strings in ASP.NET MVC 3 beta 1?

0

1 Answer 1

6

I assume you mean HTML encoding?

in the comments of this post, it says you can use the helper method Html.Raw

http://weblogs.asp.net/scottgu/archive/2010/12/16/asp-net-mvc-3-implicit-and-explicit-code-nuggets-with-razor.aspx

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

Sign up to request clarification or add additional context in comments.

8 Comments

Thanks house9 but where Raw() is located? I can't find that! System.Web.WebPages.Html?
I believe it is under System.Web.Mvc.Html - not 100% sure though
Thanks again but still i can't figure it out! Are you have use this before?
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)
No, I have found Raw() in System.Web.WebPages.HtmlHelper class, but that is internal.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.