Not sure if I did anything wrong or missed something. Tried to add app.UseStatusCodePagesWithRedirects("/error/{0}"); within Startup.cs under Configure, t gives me a Can't reach this page error. Error Code: INET_E_REDIRECT_FAILED.
Do I need to create a page e.g. 403.cshtml under /Error/ folder?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks @sonichanxiao for mentioning this. Yes, that's correct. Create a view/page for the endpoint. I just so happen to have such a endpoint in a few of my test Razor Pages apps because they use ...
app.UseStatusCodePagesWithReExecute("/Error/{0}");
... so I have a Razor Page (Error.cshtml) set up like this ...
@page "{statusCode?}"
@model ErrorModel
<!DOCTYPE html>
<!-- REST OF THE PAGE FOLLOWS HERE -->
I'll do some work on the doc to make it clear that a page/view must be created to receive a redirect or re-execute.
Thank you @guardrex , Or an updated sample code in Github would also do the job.
Good idea. I'll make a note on the sample tracking issue for this. #5495
Most helpful comment
Thanks @sonichanxiao for mentioning this. Yes, that's correct. Create a view/page for the endpoint. I just so happen to have such a endpoint in a few of my test Razor Pages apps because they use ...
... so I have a Razor Page (Error.cshtml) set up like this ...
I'll do some work on the doc to make it clear that a page/view must be created to receive a redirect or re-execute.