1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to use 301 redirect in ASP.net

Discussion in 'C#' started by Atco-maart, May 25, 2011.

  1. #1
    Hello

    I need to solved my site canonical issue regarding non www to with www so how to use 301 redirect in Asp.net ????
    SEMrush
    Please give me answer as soon as possible
     
    Atco-maart, May 25, 2011 IP
    SEMrush
  2. strike2867

    strike2867 Member

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    If you're in .Net 4.0 it is as simple as http://msdn.microsoft.com/en-us/library/dd384856.aspx. Otherwise check out this answer http://stackoverflow.com/questions/5410197/asp-net-3-5-googlebot-301-redirect-cannot-redirect-after-http-headers-have-bee.
     
    strike2867, Jun 1, 2011 IP
  3. gutierrez3711

    gutierrez3711 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Refer here
    mycsharpcorner.com/Post.aspx?postID=40
     
    gutierrez3711, Jun 8, 2011 IP
  4. yugolancer

    yugolancer Well-Known Member

    Messages:
    321
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #4
    yugolancer, Jun 9, 2011 IP
  5. neil.johnson

    neil.johnson Guest

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    In internet services manager, right click on the file or folder you wish to redirect
    Select the radio titled "a redirection to a URL".
    Enter the redirection page
    Check "The exact url entered above" and the "A permanent redirection for this resource"
    Click on 'Apply'

    ColdFusion Redirect
    <.cfheader statuscode="301" statustext="Moved permanently">
    <.cfheader name="Location" value="http://www.new-url.com">

    PHP Redirect
    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.new-url.com" );
    ?>

    ASP Redirect
    <%@ Language=VBScript %>
    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location","http://www.new-url.com/"
    %>

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

    JSP (Java) Redirect
    <%
    response.setStatus(301);
    response.setHeader( "Location", "http://www.new-url.com/" );
    response.setHeader( "Connection", "close" );
    %>
     
    neil.johnson, Jun 24, 2011 IP
  6. salikkhan

    salikkhan Greenhorn

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #6
    good neil, seems like you are master of all :)
     
    salikkhan, Jun 24, 2011 IP