Domanda

I have an Umbraco 7 site with 404 errors configured and generally working fine as long as the URL ends in a directory name or has a .aspx file extension.

Any other URLs for files that don't exist return a 404 HTTP status but the returned page is blank. How can I configure Umbraco to return my configured 404 page for all 404 responses?

The site is currently configured with a node ID in the error404 node in umbracoSettings.config and, as I say, works fine in specific cases.

I've hunted around the web but not found much help. I tried implementing my own 404 handler by implementing the INotFoundHandler interface but the effect was the same. I've also tried adding the following to the system.webserver section of web.config but this doesn't seem to change anything, and in any case I want the 404 page to be editable in Umbraco ideally.

<httpErrors existingResponse="PassThrough">
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" path="~/404.aspx" responseMode="ExecuteURL" />
</httpErrors>

Advice very appreciated.

È stato utile?

Soluzione

Update: finally found the answer on this very site, although it hadn't been marked as such. It's here - Setting errorPage in Umbraco - and the second part of the top-voted response from @sebastiaan was the answer. You essentially have to use web.config to trick Umbraco into handling all 404s!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top