How to create a 301 Redirect in c# and vb.net

If you need to redirect a page to another page or site, it’s best to use a 301 redirect to help retain some of your SEO work. It’s believed that a 301 redirect will reduce your PageRank by only 15%, compared with the 100% loss if you just redirect or use a 302 redirect.

To setup a 301 redirect is simple, as shown in the below examples:

301 Redirect using vb.net

Response.Redirect("https://rsw.io", false)
Response.StatusCode = 301
Response.End()

301 Redirect using C#

Response.Redirect("https://rsw.io", false);
Response.StatusCode = 301;
Response.End();

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*