asp.net mvc - How can I effectively prevent bot requests or at least prevent them from clogging my logs? -
i assume errors i'm getting caused bots have:
- indexed previous website under same domain; and
- are probing vulnerabilities of kind.
here of errors:
- code:
404
; type:http
; error:a public action method 'ipc$' not found on controller ...
- code:
0
; type:invalidoperation
; error:the requested resource can accessed via ssl.
there other errors specific urls used exist, have since been removed.
is there way prevent bots hitting these links or i'll have deal filtering out specific requests in elmah?
unfortunately, due amount of bots out there , variety of ways coded attack or scrape website, not able prevent of these errors. however, can choose ignore specific types of errors in elmah. here sample of filter in <elmah>
section of web.config file:
<errorfilter> <test> <or> <and> <!-- filter errors out fall in range 400-499 --> <greater binding="httpstatuscode" value="399" type="int32" /> <lesser binding="httpstatuscode" value="500" type="int32" /> </and> <regex binding="baseexception.message" pattern="a potentially dangerous \b.+?\b value detected client" casesensitive="false" /> <regex binding="baseexception.message" pattern="he provided anti-forgery token meant user" casesensitive="false" /> </or> </test> </errorfilter>
that filter out 404s etc. including errors less 400 or greater 499, , excludes couple of specific .net exceptions commonly triggered malicious bots. there, can tweak suit...
Comments
Post a Comment