asp.net - Error handling for query string parameters -1%27, getting bombarded -


i not expert, not rookie either. i'm using asp.net webforms. set error catching routine in global.asax log error info in sql table , redirect friendly error page. began finding hundreds of exceptions per day in query string "?id=-1%27". use query strings items , categories allow integers of 3 digits or less. started geo-locating ips. vast majority of them russia , surrounding countries. started storing of ips in table. else experiencing , how best handle it. want catch legitimate errors, major annoyance. input appreciated. have googled 2 days , can't find related issue.

the %27 ascii single quote (') , red flag trying perform sql injection via query string application's data access layer logic.

i less concerned attacks coming , more focused on techniques protecting/processing data before attempted used data access layer , data storage (read: database).

using parameterized sql , data sanitation (read: white-listing allowable text strings) great first step in combating these attacks.

update

it might worth considering creating custom exception invalid id value being passed in part of query string. can test length being greater 3 , throw custom exception. elsewhere can catch/trap custom exception type , whatever wish (read: potentially ignore exception if becoming large of annoyance). please understand never advocate ignoring exceptions (empty catch block), merely stating possible such "bad" thing.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -