A new feature in ASP.NET 4: Shorthand syntax for Html Encoding

(Note: This blog post was originally published under my old domain(codesmiles.com), here. Web Archive link. So far if we need to HTML encode content that we throw out to the response stream we will use Server.HtmlEncode() method as below.   <%= Server.HtmlEncode(“Content”) %>   Now in ASP.NET 4 we have a new code syntax, which comes handy whenever you want to emit content with HTML encoding, the new syntax is <%: … %> the “=” character is replaced in this new syntax by the “:” character, as shown below. <%: “Content” %>