If you are building something from scratch I would suggest Googling episerver dynamic 404 and follow one of the existing solutions others have shared.
If you already have a lot built I assume your custom error page is a EPiServer page.
You need to set it's templates's CurrentPage to a page that exits. Basically:
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
CurrentPage = DataFactory.Instance.GetPage(your error page id from some setting);
}
Hi Johan
I tried adding the below into my error page
CurrentPage = EPiServer.DataFactory.Instance.GetPage(((PageReference)CurrentPage["CustomErrorPage"]));
but still it gives me the same error when trying to browse from other machines.
In EPiServer.config (or web.config if an earlier version of EPiServer), make sure that globalErrorHandling = "Off" in the siteSettings-tag.
Hi Erik
Tried changing globalErrorHandling = "Off" but still doesnt work on other environments except development.
In my application I have setup ASP.net CustomError page for broken and faulty urls. This works fine on my development machine. But when i tries to access a faulty url receives below mentioned error on other environment.
Incorrect link
The link you gave does not work, either because the page it points to has been deleted or moved. If you clicked on a link, please inform the site’s webmaster that the link is faulty.
Please someone help me in this regard.