how to use Permanent Re-direct 301 in asp.net website

Discussion in 'Search Engine Optimization' started by uzma, Dec 30, 2009.

  1. #1
    Hi,

    Suppose if an external webpage is pointing to one of the webpages of my website which does not exist and I want to re-direct, all such requests to my home page. what should I do for that...


    suppose if a website www.xyz.com is pointing to my webpage www.abc.com/test.aspx which does not exist anymore , now all i want is that, I want to re-direct all such requests to the home page of my website. Please help and give me a detailed response. Thanks!
     
    uzma, Dec 30, 2009 IP
  2. uzma

    uzma Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    guys, please reply ...
     
    uzma, Dec 31, 2009 IP
  3. abidsultan

    abidsultan Active Member

    Messages:
    149
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    This is one of the way you can do this.

    <script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location","http://www.home-page-url.com");
    }
    </script>

    But you page should exist for this. However, you may do it in alternative way as mentioned in the URL given below.

    http://www.wrox.com/WileyCDA/Sectio...tus-Codes-with-ASP-NET-and-IIS.id-306460.html
     
    abidsultan, Dec 31, 2009 IP