HELP my site gets a 302 temporary redirect

Discussion in 'ASP .Net' started by Jeff, Jan 7, 2010.

  1. Jeff

    Jeff Guest

    hey

    asp.net 3.5

    I've been testing my site against the free seo tool
    http://www.instantposition.com/seotest.php and discovered that it gets a 302
    temporary redirect. I've contacted the ISP and they say there is nothing
    wrong with the server config or anything like that. He said it could be some
    issues with my code or web.config.

    But I don't know what that could be as I guess my code is pretty straight
    forward. I don't do any redirect other than to avoid double posting forms

    I used to have a canonical-url in the Defaut.aspx file, thought the problem
    was caused by that one. Then I read that canonicalurl don't work so great on
    IIS6 so I googled and came across an article which recommended this code
    instead:
    void Application_BeginRequest(object sender, EventArgs e)
    {
    string requestedDomain =
    HttpContext.Current.Request.Url.ToString().ToLower();

    if (requestedDomain.IndexOf("http.mysite.com") > 0 )
    {
    requestedDomain = requestedDomain.Replace("http://mysite.com",
    "http://www.mysite.com");
    Response.Clear();
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location", requestedDomain);
    Response.End();
    }
    }

    Don't think that code has anything to do with the problem, cause I haven't
    seen any changes in the error after I removed the cannonicalurl and
    implemented the code above. I guess it must be something else, but what I'm
    not sure...

    My site funnyquotesonline (dot) org which gets the 302 temporary redirect

    any suggestions?
    Jeff, Jan 7, 2010
    #1
    1. Advertising

  2. Jeff

    bruce barker Guest

    session uses a 302 o set the cookie

    -- bruce (sqlwork.com)

    Jeff wrote:
    > hey
    >
    > asp.net 3.5
    >
    > I've been testing my site against the free seo tool
    > http://www.instantposition.com/seotest.php and discovered that it gets a 302
    > temporary redirect. I've contacted the ISP and they say there is nothing
    > wrong with the server config or anything like that. He said it could be some
    > issues with my code or web.config.
    >
    > But I don't know what that could be as I guess my code is pretty straight
    > forward. I don't do any redirect other than to avoid double posting forms
    >
    > I used to have a canonical-url in the Defaut.aspx file, thought the problem
    > was caused by that one. Then I read that canonicalurl don't work so great on
    > IIS6 so I googled and came across an article which recommended this code
    > instead:
    > void Application_BeginRequest(object sender, EventArgs e)
    > {
    > string requestedDomain =
    > HttpContext.Current.Request.Url.ToString().ToLower();
    >
    > if (requestedDomain.IndexOf("http.mysite.com") > 0 )
    > {
    > requestedDomain = requestedDomain.Replace("http://mysite.com",
    > "http://www.mysite.com");
    > Response.Clear();
    > Response.Status = "301 Moved Permanently";
    > Response.AddHeader("Location", requestedDomain);
    > Response.End();
    > }
    > }
    >
    > Don't think that code has anything to do with the problem, cause I haven't
    > seen any changes in the error after I removed the cannonicalurl and
    > implemented the code above. I guess it must be something else, but what I'm
    > not sure...
    >
    > My site funnyquotesonline (dot) org which gets the 302 temporary redirect
    >
    > any suggestions?
    >
    >
    bruce barker, Jan 8, 2010
    #2
    1. Advertising

  3. Jeff

    Jeff Guest

    thank you :)

    "bruce barker" <> wrote in message
    news:%...
    > session uses a 302 o set the cookie
    >
    > -- bruce (sqlwork.com)
    >
    > Jeff wrote:
    >> hey
    >>
    >> asp.net 3.5
    >>
    >> I've been testing my site against the free seo tool
    >> http://www.instantposition.com/seotest.php and discovered that it gets a
    >> 302 temporary redirect. I've contacted the ISP and they say there is
    >> nothing wrong with the server config or anything like that. He said it
    >> could be some issues with my code or web.config.
    >>
    >> But I don't know what that could be as I guess my code is pretty straight
    >> forward. I don't do any redirect other than to avoid double posting forms
    >>
    >> I used to have a canonical-url in the Defaut.aspx file, thought the
    >> problem was caused by that one. Then I read that canonicalurl don't work
    >> so great on IIS6 so I googled and came across an article which
    >> recommended this code instead:
    >> void Application_BeginRequest(object sender, EventArgs e)
    >> {
    >> string requestedDomain =
    >> HttpContext.Current.Request.Url.ToString().ToLower();
    >>
    >> if (requestedDomain.IndexOf("http.mysite.com") > 0 )
    >> {
    >> requestedDomain =
    >> requestedDomain.Replace("http://mysite.com", "http://www.mysite.com");
    >> Response.Clear();
    >> Response.Status = "301 Moved Permanently";
    >> Response.AddHeader("Location", requestedDomain);
    >> Response.End();
    >> }
    >> }
    >>
    >> Don't think that code has anything to do with the problem, cause I
    >> haven't seen any changes in the error after I removed the cannonicalurl
    >> and implemented the code above. I guess it must be something else, but
    >> what I'm not sure...
    >>
    >> My site funnyquotesonline (dot) org which gets the 302 temporary redirect
    >>
    >> any suggestions?
    Jeff, Jan 8, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Zsolt Nagy

    Re: httpconnection class handle 302 redirect?

    Laszlo Zsolt Nagy, Dec 7, 2004, in forum: Python
    Replies:
    0
    Views:
    983
    Laszlo Zsolt Nagy
    Dec 7, 2004
  2. ThunderMusic
    Replies:
    1
    Views:
    391
    bruce barker
    Jan 26, 2007
  3. David Morgan
    Replies:
    1
    Views:
    314
    raj chahal
    Feb 24, 2006
  4. Chris McMahon

    Net::HTTP::Put with 302 redirect?

    Chris McMahon, May 21, 2007, in forum: Ruby
    Replies:
    1
    Views:
    316
    Brian Candler
    May 21, 2007
  5. zeeboo
    Replies:
    4
    Views:
    208
    Praveenbhalla Praveenbhalla
    Dec 4, 2010
Loading...

Share This Page