Cleanup user input library .NET
-
11-09-2019 - |
Question
Is there a .Net library which everyone uses to validate/cleanup user input from website. It seems like there are a lot of posts explaining which regex people use and when. While I do like to reinvent the wheel quite frequently I draw the line at user input.
Mostly I am not worried about SQL injection, but rather am concerned about html inputs and inputs which I cannot imagine. It would just put a smile on my face for it to work like this:
string sanitizedInput = InputSanitizer.SanitizeInput(input, SanitizeOption.RemoveHTML
| SanitizeOption.RemoveSQL);
Anyone have anything like this? (Thanks in advance)
Solution
The latest version of AntiXSS has HTML sanitization functions that MS use internally.
OTHER TIPS
There's xVal:
and the Validator toolkit:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow