UseStatusCodePagesWithReExecute .net 6

net logo

I got some problem when trying to use custom error pages in a .net 6 mvc web app. Using UseStatusCodePagesWithReExecute to redirect to an error controller on exceptions like 404 or 500 response status. But the error controller never got fired. Discovered that this problem was due to that the UseStatusCodePagesWithReExecute call needs to be called before app.UseRouting() in Startup.cs. Else it didn’t work for me!

startup
Hope this helps someone who is experiencing the same problem!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.