Custom 404 page not found

Hello,
In my app, I want to handle ALL not-found/incorrect URLs by showing a generic NotFound Page that contains a simple message and a link to the home page, instead of the ugly default browser page.So I have created a custom file with the needed content and gave it the URL “/not-found”.Now how should I tell the app to route all not-found URLs to my custom page URL (“/not-found”)? and at what server event?Thank you in advance.

By default, 404 errors are handled by the error page. If you want to use your own, you will need to customize the Startup.cs page as explained in:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-5.0

Thank you for the reply,
Yes , I know it is easy using Visual Studio,
but in my question, I have indicated that I want to do it form inside AspnetMaker itself, because editing the project after creating it using Visual Studio is not an acceptable solution, simply because it will be overwritten on the next project regeneration, which I do a lot.How to do that from inside AspnetMaker ?

If you do not want to modify the generated codes, I don’t think there is a simple way to do this except by modifying the template file “Startup.cs”.

Modifying the template file “Startup.cs” seems a great idea,There is a lot of templating stuff there (I think it is for the Node generating engine), and I don’t want to subvert them, so please guide me on what to change exactly and where.All I need is to handle only the 404 error and redirect it to the (~/not-found) page.Thank you for your valuable help and support.

Please read help file topic: Customizing Template to understand how to customize the template. Look for the changes you need to make in the template file “Startup.cs”.