How to Stop Azure IIS Appending Error Status Code Query String
Asked Answered
D

1

6

I have the following setup in my web.config file to handle errors:

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

When I throw an exception in my app it works fine locally but it redirects to the following URL in error-page in azure (note that the page I threw the exception from is at the end of the URL:

https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/error/internalservererror/?500;https://example.com/about/

How do I stop IIS from exibiting this behaviour in Azure?

Dunc answered 10/4, 2016 at 7:21 Comment(1)
Just tried your configuration but cannot reproduce this behavior, both work fine when running locally and published to azure. I am wondering whether you have other redirection rules on IIS?Fortune
R
1

Just add a question mark at the end of your path parameter, using your code you would have something like this:

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="500" />
  <error statusCode="500" responseMode="ExecuteURL" path="/error/internalservererror/?" />
</httpErrors>
Ricky answered 11/4, 2016 at 15:29 Comment(2)
I'm unable to resolve the issue with this answer? I'm using Rehan's MVC 5 Boilerplate template. Any suggestions?Martineau
what is the logic behind of this? btw it is not worked.Pentecost

© 2022 - 2024 — McMap. All rights reserved.