I use htaccess to handle illegal characters in a request path. This works as expected and routes visitors to the correct error page in WS2K8 R2, but when I migrate to SP1, it instead throws the "potentially dangerous characters in request.path" error before htaccess can handle it. In both environments I am on IIS 7.5.
To solve this, I added the requestPathInvalidCharacters httpRuntime attribute in my web.config to allow all dangerous characters as follows:
<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" />
This prevents returning the potentially dangerous Request.Path error to the browser and allows htaccess to handle the request; however, CheckInvalidPathChars still sends an "Illegal characters in path" exception to the application log and enterprise library still emails the exception.
My questions are threefold:
Why is the httpruntime setting trumping my htaccess rule in SP1 when it does not do this on WS2K8 R2?
Why isn't CheckInvalidPathChars using my requestPathInvalidCharacters setting?
How can I prevent CheckInvalidPathChars from throwing this exception?