How do I override RequestValidation in ASP.NET WebAPI
问题 I'm having problems with requests that include 'dangerous characters' as part of a Web API URL. The Url includes an & which is properly Url encoded, but still causes a Request Validation ASP.NET error. Unlike MVC there appears to be no [ValidateInput(false)] attribute to force and disable this functionality. 回答1: Turns out the answer is to do this in web.config using: <system.web> <httpRuntime requestPathInvalidCharacters="" /> </system.web> You can set this globally or at the sub-directory