Sometimes we get some robots who like to post bad information on our website (they try some kind of reflection attack), but good luck for us, the attempts are stopped by checking the default input that you get using MVC.
This is good and thatβs it, but now we want to see what the robots really send, and we would like to register this information. Unfortunately, when a person receives an HttpRequestValidationException , the abusive input is truncated to the point of uselessness ala;
A potentially dangerous.... (field = <a href=.....)
I try to use an action filter to detect these exceptions, and then I create a log of all violating input data so that we can see what they are trying to send.
public void OnException(ExceptionContext filterContext) { HttpRequestValidationException hex = filterContext.Exception as HttpRequestValidationException; if (hex == null) { return; }
It seems strange and annoying to me, because it seems that now I have no way to find out what my attackers are actually doing. Isn't there a way to get information from form data without getting exceptions?
source share