Im trying to create my own custom error 404 handler. I've followed the "how to"-guide here on Our Umbraco but I can't get it to work.
This is the code I have right now.
My handlerclass:
namespace AVWebUmbraco.UmbracoExtensions.Eventhandlers
{
public class NotFound : INotFoundHandler
{
private int redirectId;
public bool Execute(string url)
{
var server = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToLower();
if (server == "www.mydomain1.com")
{
redirectId = 1234; // the id of the 404 and search page from domain1.com
return true;
}
if (server == "www.mydomain2.com")
{
redirectId = 5678; // the id of the 404 and search page from domain2.com
return true;
}
return false;
}
public bool CacheUrl
{
get { return false; }
}
public int redirectID
{
get { return redirectID; }
}
}
}
Custom error handler not working as intended
Im trying to create my own custom error 404 handler. I've followed the "how to"-guide here on Our Umbraco but I can't get it to work.
This is the code I have right now.
My handlerclass:
404handlers.config:
The error I get is:
Could it have something do with these lines under
If anyone can help me with this issue I would be very grateful. I only have today to solve it..
Comment author was deleted
Hmm think your notFOund element isn't correct , which version of Umbraco are you running since the INotFOundHandler will be obsolete http://blog.dampee.be/post/2013/11/21/From-the-legacy-INotFoundHandler-to-IContentFinder.aspx
Im using Umbraco 7.2. I will check your link, thanks!
is working on a reply...