this may be very basic to some people but I have never encountered it before. I was recently going through an MVC tutorial and came across 2 exercises, one used <%= %> the other used <%: %>. Subsequently the first exercise didnt work (although it did in the video I watched) but I have never seen the second notation before. Can anyone explain the difference? Thanx in advance.
Asked
Active
Viewed 72 times
0
-
it is not a duplicate of that question (the : vs # makes all the difference in asp.net) but the answer to this question can be found in the comprehensive answer to that post. – Paul Hiles Jun 17 '13 at 12:49
1 Answers
0
<%:%>
That's introduced in Asp.net 4.
Both Renders the output but later one encodes HTML by default.
while using
<%=%>
you have to explicitly encode HTML input.
For more info, check out Scott Guthrie's blog post

Nilesh Thakkar
- 2,877
- 1
- 24
- 43