I am using URL Rewrite on IIS 7.5 to hide the server disclosure header for an ASP.NET Webforms application and everything is working fine in my main application. However, on custom error handling, the rewrite is not firing at all.
In my web.config:
<outboundRules>
<remove name="Remove Server header" />
<rule name="Remove Server header" enabled="true">
<match serverVariable="RESPONSE_SERVER" pattern=".+" />
<action type="Rewrite" value=" " />
</rule>
</outboundRules>
Also in the section:
<modules runAllManagedModulesForAllRequests="true" />
HTTP Errors:
<httpErrors errorMode="Custom">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/404Check.aspx" />
</httpErrors>
Custom errors:
<customErrors mode="On" >
<error statusCode="404" redirect="~/404Check.aspx"/>
</customErrors>
On the custom 404 page, it simply looks for a couple of values for processing a login attempt. If no values are found, it displays an error message to the user.
Is there something I'm missing?