11

I've noticed weird behavior in IIS error pages. I've got this setup:

<httpErrors errorMode="Custom" existingResponse="Replace">
 <remove statusCode="500" />
  <error statusCode="500" responseMode="ExecuteURL" path="/error-page" />
</httpErrors>

Sometimes when an ASP.NET error occurs due to the query string being too long, then immediately the second error occurs while trying to execute the error page URL. I've tracked the problem to the fact that IIS appends the original url to the error page url like:

Original: http://example.com/someurl?id=some_very_long_query_string_causing_security_exception
Error: /error-page?500;http://example.com/someurl?id=some_very_long_query_string_causing_security_exception

This is a huge problem. If the original url fails for having a query string too long then the error page with the the appended stuff fails as well because it has a query string that is even longer!

I believe this is the dumbest bug in IIS. Does anyone know if there was some patch of service pack for that? Worst case scenario if nothing is fixed by now, is there a way to disable this behavior or any tricks to stop IIS appending unsolicited stuff to the error page? Because it breaks the whole custom error page mechanism.

2
  • Sir, I faced same problem. Did you solve it?
    – Denis
    Nov 24, 2015 at 21:55
  • 1
    +1 I've asked the same question on StackOverflow here. Would love an answer. Apr 10, 2016 at 7:22

2 Answers 2

1

Adding a trailing slash to the path (e.g. path="/error-page/") will stop the error code and URL being appended, note that it will keep the original failing URL, e.g.

0

I similar issue a long time ago, the system in question uses static error pages because of it.

You can set that in the defaultResponseMode to file which will serves back a single static page.

httpErrors Element IIS Settings Schema

There is also a similar issue here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .