HtmlHelper.Raw Method (String)

Wraps HTML markup in an HtmlString instance so that it is interpreted as HTML markup.

Namespace:  System.Web.WebPages.Html
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

public IHtmlString Raw(
	string value


Type: System.String
The string to interpret as HTML markup instead of being HTML-encoded.

Return Value

Type: System.Web.IHtmlString
The unencoded HTML.

The Razor syntax @ operator HTML-encodes text before rendering it to the HTTP response. This causes the text to be displayed as regular text in the web page instead of being interpreted as HTML markup.

Use the Raw method when the specified text represents an actual HTML fragment that should not be encoded and that you want to render as markup to the HTTP response.