0

I'm looking for C# library that protect my application against Xss attack and Sql and NoSql injection attacks. My program works like an http server and get users data throw socket and process them in Sql server or MongoDb. Is there any library for this job or it's not needed for this layer of application and we have to protect it in level of Sql server and MongoDb or I have to know all Xss and Sql Injection tips and write my own prevent?

Remember when I get user Http header in my program I replace this keywords but some security reports fail:

.Replace("%3C", "").Replace("%3E", "").Replace("<", "").Replace(">", "").ToLower().Replace("script", "").Replace("function", "").Replace("alert", "");
  • Not sure for Mongo, but for SQL Server just using parametrized queries will do the job, you don't need a library for that. – Alejandro Dec 4 '18 at 14:39
  • @Alejandro We've defined Javascript functions in Mongo and call them from C#. Should we consider anything for getting XSS test successful and not vulnerable anymore? – Hamed_gibago Dec 4 '18 at 17:17
  • @Alejandro Another question. Is it duty of Webserver to prevent XSS injection or job of Web application developer? – Hamed_gibago Dec 8 '18 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.