I have a situation in which I cannot control the response from the IIS when the request contains many subfolders that exceed the value of the maxUrlSegments setting (default = 32). See image: enter image description here

In fact, when the number of the subfolders is lower than 32, the request goes normally through the global.asax subs and I can also apply rewrite rules in the web.config. When the number of the subfolders is higher than 32 the request does not go through the normal cycle and is served from somewhere else (where?) and so that server name -which I want to hide- is visible in the 404.20 response.

I tried adding a rewrite rule in the web.config but the request does not go through the web.config if the number of the subfolders is greater than 32. It only respects the rule when the number of subfoders is between 10 and 32.

<rule name="RemoveSlashAfter10thFolder" stopProcessing="true"> <match url="^(.*?/.*?/.*?/.*?/.*?/.*?/.*?/.*?/.*?/.*?/)(.*)$" /> <action type="CustomResponse" statusCode="403" /> </rule>

Any assistance will be appreciated.

0

There are 0 best solutions below