Unpublished pages throws 500 error #1915
Answered
by
tidyui
vindhya124
asked this question in
General
-
Is there a way we can throw 404 (Not found) instead of 500 error when application is trying to access an unpublished page? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Answered by
tidyui
Aug 2, 2022
Replies: 1 comment 1 reply
-
This is actually handled for Razor Pages here: But we might add logic for it earlier in the routing as well. Right now you can solve it in you controllers by returning NotFound when the model loader returns null. Best regards |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
vindhya124
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is actually handled for Razor Pages here:
https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha.AspNetCore/Models/SinglePage.cs#L62
But we might add logic for it earlier in the routing as well. Right now you can solve it in you controllers by returning NotFound when the model loader returns null.
Best regards