I have an ASMX web service that provides various search utilities. If my user inputs too little search criteria, I want to have the web service return an HTTP 500 with a custom message. How do I do this? I do not want to handle the insufficient input on the client side because of in-browser manipulation abilities.
HTTP 500 means internal error. Throwing an unhandled exception should give you a HTTP 500.
throw new Exception("Your error message");
However, it is probably not a good idea to do this.
A better approach would be to throw a SOAP fault.