I would like to implement a my own custom page not found to present a friendlier error message to the user when they request a page url that does not exist.
I have done some research and many suggest updating the page ID reference in the <error404>1</error404> tag in the umbracoSetttings.config. Is there a better approach to do this or is this the only way to do it in umbraco?
In other asp.net mvc applications i have seen it where you can create a controller e.g. pageNotFound controller and in there you just put the follwoing code that simply returns a view
// GET: PageNotFound
public ActionResult Index()
{
//return 404 view when site page not found
return View();
}
In your view (My view is a page that i created in umbaco) you add all your styles to make it look presentable and the final step is to add something like the following in the web.config
However, i have tried doing this in my umbraco install and im not really getting anywhere. The furthest i got is my page was rendering but not of the properties were displaying because it appeared to be redirecting to the home page and of course that doesnt have any of my properties as its not the currentPage.
Im a little confused, so any help or links to documentation to help me implement this functionality will be helpful.
MVC Umbraco 7 Custom 404 Page help
Hi All,
I would like to implement a my own custom page not found to present a friendlier error message to the user when they request a page url that does not exist.
I have done some research and many suggest updating the page ID reference in the
<error404>1</error404>
tag in the umbracoSetttings.config. Is there a better approach to do this or is this the only way to do it in umbraco?In other asp.net mvc applications i have seen it where you can create a controller e.g. pageNotFound controller and in there you just put the follwoing code that simply returns a view
In your view (My view is a page that i created in umbaco) you add all your styles to make it look presentable and the final step is to add something like the following in the web.config
View example
However, i have tried doing this in my umbraco install and im not really getting anywhere. The furthest i got is my page was rendering but not of the properties were displaying because it appeared to be redirecting to the home page and of course that doesnt have any of my properties as its not the currentPage.
Im a little confused, so any help or links to documentation to help me implement this functionality will be helpful.
Many thanks Paul
Paul,
You can write your own content finder see https://our.umbraco.org/forum/developers/extending-umbraco/60869-404-handler-using-IContentFinder-not-working- instructions on http://creativewebspecialist.co.uk/2013/08/07/the-new-way-to-do-a-404-umbraco-handler/
Regards
Ismail
Hi Ismail,
Thanks for the quick response, i will take a look at the links you provided and see whether i can work this one out :)
Thanks Paul
Comment author was deleted
Hi Paul,
A super easy way is using this package: https://our.umbraco.org/projects/backoffice-extensions/umbraco-page-not-found-manager/
Then you have some UI that allows you to pick a 404 page for your site(s)
Hi Tim,
Thanks for showing me this package, i will take a look :)
Many thanks Paul
Hi lads,
I decided to following warrens blog post that Ismail provided a link to and I now have the 404 page working 😄.
The reason I chose that method is I'm trying to get better with programming and although it's only following something at least I'm writing code.
However, I will try Tim's package as I'm genuinely interested in seeing it.
Thanks for your input guys, really helpful.
Paul
is working on a reply...