ASP.NET Response.Redirect uses 302 instead of 301 ASP.NET Response.Redirect uses 302 instead of 301 asp.net asp.net

ASP.NET Response.Redirect uses 302 instead of 301


If you're using ASP.Net 4.0, you can use Response.RedirectPermanent, which will use 301 instead of 302.


Response.Redirect() will overwrite the StatusCode property with the code for a redirect (302). Also, because you're using the Response.Redirect() overload taking the boolean parameter, you should set it to False if you want to call Response.End() yourself. Otherwise it's redundant and can cause errors.

Try the following (pre-ASP.NET 4.0; Adam Butler's answer covers the new best practice):

context.Response.Redirect(newUrl, false);context.Response.StatusCode = 301;context.Response.End();


301 is cache-able. if you are using ASP.NET 4.0 , you can use RedirectPermanent.

Also, set your statuscode after Redirect

also, look into these answers. Response.Redirect HTTP status code