Is it possible to create a class that implements 'INotFoundHandler' but instead of redirecting by passing in a nodeid. Redirect to a url I specify? like /my-domain/my-re-written-page-name ??
Ahh. So you 'could' simply response.redirect (Or 301 redirect) from within the execute method and it would work correctly and correct header status code gets set?
INotFoundHandler To Custom Url?
Is it possible to create a class that implements 'INotFoundHandler' but instead of redirecting by passing in a nodeid. Redirect to a url I specify? like /my-domain/my-re-written-page-name ??
Think you can set the response code to 301. Try the SetResponse method below.
Hope this helps,
Richard
i'm using a redirectpermanent(newurl) in the execute method of the not found handler which works as expected and sets the codes and location for you.
/Dirk
Ahh. So you 'could' simply response.redirect (Or 301 redirect) from within the execute method and it would work correctly and correct header status code gets set?
Yup, PermantRedirect does all the stuff for you, just need to provide the new url to redirect to.
/Dirk
Yup and Dirk's comment is better. I used the old one since it came from a .net 2.0 project...
Where is this permanantRedirect method? I can't find it in umbraco.library?
HttpContext.Current.Response object
Oops, it's RedirectPermanent instead of PermanentRedirect
Thanks chaps :)
is working on a reply...