Replies: 8 comments 15 replies
|
You can override the 404 by adding a NotFound.cshtml or .liquid file in Views/Shared: |
|
That still doens't work. I have put \Views\Shared\NotFound.cshtml then browse to https://localhost:44360/test , still got the default asp.net not found error. I see there are reponse referencing to OrchardCore.Diagnostics, but how to make it work?? Maybe added to Nuget and then ? Many thanks! |
|
So you defined the not found page from the app, normally that's okay as an application behaves as a module and as a super theme. We already set an higher precedence for the shape template views defined at the app level, but not for pure mvc views Already fixed locally on my machine, i will do a PR soon, good catch. |
|
Thanks @jtkech , any idea how can I get this change into my code? |
|
Hi @jtkech I also put the NotFound view under View/Shared folder, it also contains 1 line of code:
Is there anything else need to modify based on the out of box / standard MVC website project? Here's the startup.cs Here's the program.cs |
|
Looks good I tried it with the full source code, tomorrow i will try it by using package references Hmm, show me your Are the other views discovered? |
|
Aha, the NotFound works propertly if I specify a Theme from here: /Admin/Themes |
|
Some remarks after a quick look Don't use route in razor view, only if using razor page (see below) Normally to render a "page" it is through one of our custom controller that display a content item that was created through the admin UI, and whose content type includes an When we define a route in a razor file, usually we use razor pages (with a Not sure you need the Not related but you call twice Not good to reference Anyway you just need to reference Try also by referencing Which setup recipe did you use on setup? I assume the blank site, right?
Just saw this comment, yes you need at least one selected theme, so that the theming engine is used and the app can override the current theme views Hmm, but normally it should still work as the notfound is a mvc view, as i remember i tried it and it was working, hmm maybe because i had a selected front end theme just before, i will retry it |



Uh oh!
There was an error while loading. Please reload this page.
I am using the latest version of orchard core cms and have defined all pages within the Pages folder as displayed below.
I am unable to find any documentation on how I can set up a custom error page to deal with 404 NotFound and internal 500 errors.
Would appreciate any help.
Thank you
All reactions