In ASP.NET unable to save TextBoxes if the text is

2019-09-10 06:48发布

问题:

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

回答1:

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



回答2:

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 .