How to Html.Encode in webforms

Mr Cricket picture Mr Cricket · Oct 25, 2010 · Viewed 13.1k times · Source

I have an ASP.NET Web Forms application. There is a page with TextBoxes and users enter search terms into these which are used to query the database.

I know that I need to prevent JavaScript injection attacks. How do I do this?

In MVC I would use Html.Encode. It doesn't seem to be recognized in Web Forms.

Thanks!

Answer

Badaro picture Badaro · Oct 25, 2010