Reputation: 609
I've got request to URL of this kind: https://xxx/test/%81
This results in 400 Bad Request - Invalid URL
I tried to set in web.config:
<httpRuntime requestValidationMode="2.0" relaxedUrlToFileSystemMapping="true" requestPathInvalidCharacters=""/>
But it does not help.
I also tried to use custom request validator:
<httpRuntime requestValidationType="MyNamespace.CustomRequestValidation"/>
But IIS returns 400 before using custom validator.
What else can I do to make IIS to accept this URL?
Thank you.
Upvotes: 1
Views: 8789
Reputation: 609
According to https://www.iis.net/learn/troubleshoot/diagnosing-http-errors/troubleshooting-http-400-errors-in-iis the underlying problem of HTTP 400 is that the client has sent a request to IIS that breaks one or more rules that HTTP.sys is enforcing.
Http.sys registry settings for Windows are dercribed here: https://support.microsoft.com/en-us/kb/820129
So, in my case problem was solved by creating following DWORD values under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters as IIS machines:
AllowRestrictedChars = 1
EnableNonUTF8 = 1
After applying these changes to registry IIS machines have to be restarted
Upvotes: 4