I am doing a SEO-friendly redirect, using Visual Studio 2008 (I am stuck on this version) like so:
public static class RedirectExtension
{
public static void RedirectPermanent(this HttpResponse response, string pathUrl)
{
response.Clear();
response.Status = "301 Moved Permanently";
response.RedirectLocation = pathUrl;
response.End();
}
}
}
The redirect happens via selection of an item in a dropdown, which displays flag images (using a popular jquery dropdown extension) and region selected. For some selections, since we don’t have subdomains for the region selected, I redirect to the same place. (For reasons unknown, I’m forced to redirect, otherwise the page name displays, which the SEO folks do not want.)
I need to pass the index that was selected somehow, so that I can generate the appropriate first item of the dropdown. I always display the first item. (I don’t want to force selection of an item, since that would enter an infinite redirect and select loop.)
I’m extremely limited in terms of what I can do, since everything is running inside of an awful old sitefinity site that I have inherited, which I can not even debug.
If querystring won’t work, one last approach is to use cookie. Set cookie before redirect.
On request you should check if cookie is set.