ASP.NET 4 HTML Encode

Thursday, 3 June 2010 02:15 by scngan

HTML encode is very important as it can help to prevent XSS and HTML injection attack.

Before asp.net 4, developer will need to use ,

<%= Server.HtmlEncode(what.ever.message) %>

Server.HtmlEncode function to encode the message.

Now, with ASP.NET 4, you can use

<% : what.ever.message %>

to encode your message.

So, is basically putting " : " in between <% %> and it will help you.

Hope you find this useful.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   MVP | Technical Stuff
Actions:   | E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed
Comments are closed