How do you avoid XSS vulnerabilities in ASP.Net (MVC)?

Viewed 18639

I recently noticed that I had a big hole in my application because I had done something like:

<input type="text" value="<%= value%>" />

I know that I should have used Html.Encode, but is there any way to do that for all values, without having to do it explicitly?

5 Answers
Related