I need to permanent redirect some pages, and redirect the user to the new URL as well.
This code only sets the correct headers. The user are not redirected.
public static void PermanentRedirect(this HttpResponse response, string newUrl)
{
response.Status = "301 Moved Permanently";
response.StatusCode = 301;
response.AddHeader("Location", newUrl);
}
If I put:
Response.Redirect(newUrl);
at the end, a 302 Temporary Redirect is performed.
How can I 301 redirect the user?
Related Questions: