I wish to encode my HTML sent to the browser. In my .ASPX pages I can use the <%: %> syntax. In a HTML helper of mine I try...
public static string Image(this HtmlHelper helper, string imageName, string altText)
{
return helper.Encode(String.Format("<image src='/images/{0}' alt='{1}' />", imageName, altText));
}
However, when the HTML reaches the browser the HTML just displays as text and no image is shown. How does one encode their HTML from a helper method?