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", "");