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 and now we’ve moved to 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";

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.