One of our legacy websites based on the classic ASP.NET technology was moved to a new hosting. Now it's a cloud running Windows Azure Pack in which our site is running under .NET Framework 4.6.1.
However, I still can't return a custom error page for a non-existing .aspx resource with the correct HTTP status 404 - the status is always 302. Originally the custom 404 error page was defined like this in web.config:
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="/error/server-error.aspx">
<error statusCode="404" redirect="/error/resource-not-found.aspx"/>
</customErrors>
</system.web>
I did read SO posts like this and tried the suggested answers including setting the redirectMode to ResponseRewrite, but nothing helped or did not work as expected.
Did I miss something, or is there another solution?