Html Encoding Code Blocks With ASP.NET 4
Posted by: youve been HAACKED,
on 25 Sep 2009 |
View original | Bookmarked: 0 time(s)
One great new feature being introduced in ASP.NET 4 is a new code block (often called a Code Nugget by members of the Visual Web Developer team) syntax which provides a convenient means to HTML encode output in an ASPX page or view. <%: CodeExpression %>
I often tell people its <%= but with the = seen from the front.
Lets look at an example of how this might be used in an ASP.NET MVC view. Suppose you have a form which allows the user to submit their first and last name....