If the text input is between 'greater Than' and 'less than' symbol, I am unable to save the text. Kindly find a solution to this either in Javascript or ASP.net
Asked
Active
Viewed 1,272 times
0
-
2Possible duplicate of ["<" in a text box in ASP.NET --> how to allow it?](http://stackoverflow.com/questions/4146309/in-a-text-box-in-asp-net-how-to-allow-it) – xanatos Feb 19 '16 at 08:58
-
1This has nothing to do with Classic ASP. – Paul Feb 19 '16 at 09:39
-
Please suggest me: I need to show validation only if some text is entered in between < and >. Rest of the cases should be accepted by the browser. Suggest a solution without security concern. – Sachin Feb 23 '16 at 10:31
2 Answers
0
Such symbols are forbidden for security reasons - otherwise someone can simply inject their code. If you need to pass such symbols you should pass them like this : "/<" "/>"
Or Set TextBox attribute ValidateRequestMode = ValidateRequestMode.Disabled

S. Nadezhnyy
- 582
- 2
- 6
0
If you want to allow HTML tags i.e "<>" then you need to set validateRequest="false" in ASP pages , best thing is to parse those tags using HTML encoder .

Rakesh Bk
- 112
- 15
-
-
-
-
I tried that. But not working. I am using ASP.NET 4.5. Anything extra to be added? – Sachin Feb 19 '16 at 09:59
-
Its working when I gave requestValidationMode="2.0" in httpruntime its woring Thanks Rakesh – Sachin Feb 19 '16 at 10:18
-
-
the drawback is that , security get's compromised , you should use asp.net "Antixss" or create your own text parser to avoid user entering malicious links and javascript code along with data , google for javascript libraries – Rakesh Bk Feb 19 '16 at 12:47