Return a code 301 (Moved Permanently) in C#

In some cases we need to inform third parties that a page of ours, or even an entire domain has been moved to another site.

A clear example might be that the domain had www.newagedesign.com and now we’ve moved to www.newagedesign.es. The ideal is to notify everyone that our web address has changed, but this is sometimes not possible or may take a long time. In these cases it is best to redirect the visitor but indicating that redirect because the site has moved.This is achieved by returning a 301 error.

All this said about a domain also applies to a specific page.

For. NET this would be inserting the following code in the page you want to redirect:

Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.newagedesign.es/");
Response.End();

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.