I am working on a website that is made in asp.old and there is a lot of pages (categories [category.asp?id=xx] and products [product.asp?id=yy]) and now I am not sure where it will be best to implement 301 redirect.
I am using ContentFinder to show the right category and product when reading the url and I can get the ContentFinder to fire when getting the asp.old page. But can I implement the 301 redirect in the ContentFinder class? Or do I need to do it in web.config?
You can implement the redirect in the content finder.
The PublishedContentRequest has a SetRedirectPermanent method:'
public class PermanentRedirectFinder : IContentFinder
{
public bool TryFindContent(PublishedContentRequest contentRequest)
{
// is it an old url that needs redirecting?
// determine new url
string newUrl = "/whatever/it/should/be";
contentRequest.SetRedirectPermanent(newUrl);
return true;
}
}
301 redirect of asp.old pages
I am working on a website that is made in asp.old and there is a lot of pages (categories [category.asp?id=xx] and products [product.asp?id=yy]) and now I am not sure where it will be best to implement 301 redirect.
I am using ContentFinder to show the right category and product when reading the url and I can get the ContentFinder to fire when getting the asp.old page. But can I implement the 301 redirect in the ContentFinder class? Or do I need to do it in web.config?
Hi Niels
You can implement the redirect in the content finder.
The PublishedContentRequest has a SetRedirectPermanent method:'
That is so perfect :) Nice
is working on a reply...