ASP.NET validation

I am getting a validation error when the user enters a foreign name. Example:

System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was found on the client (ctl00 $ pageContent $ txtName = "Pedro ú logo").

where ú translates as # 250; (no spaces, of course)

These foreign characters are legal and should not cause a validation error. I want ASP.NET validation to be validated using UTF-16, not UTF-8

Many websites, blogs and forums say to just disable validation (ie ValidateRequest = "false")

Is there a way to get around this without disabling validation? Disabling validation is not appropriate for this application.

Thanks, Jeff

+1


a source to share


2 answers


The request validation mechanism cannot be configured. It's kind of hardcoded. I see no reason why you don't want to disable it. If you take care of sanitizing and HTML-coding everything you get from the user and you want to render on the page (which you should be doing anyway, regardless of ASP.NET request validation), you won't need that.



+1


a source


I had this problem.

The path to it is to clear the input with javascript before you get into the post.



See fooobar.com/questions/948 / ... for some javascript

Also, this is almost a duplicate of this stacking question (linked above)

0


a source







All Articles