C# .NET - potentially dangerous request.form value was detected from the client asp.net 4.0

Asked By veni on 01-Feb-13 04:57 AM
I am having one textbox for search functionality.If I am searching with the search keyword that starts with '<',the page is getting continuously loading and i am getting the error 'potentially dangerous request.form value was detected from the client c# asp.net 4.0'.Because it is taking the search keyword '<test' as a HTML Tag.How to handle this '<' character.Can any one please provide me the solution for this issue?
Robbe Morris replied to veni on 01-Feb-13 10:19 AM
You'll need to add ValidateRequest="false" to your Page tag in your .aspx page.  Then, add this to your web.config:

<system.web>
    <httpRuntime requestValidationMode="2.0"/>
</system.web>