Redirects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stan Canepa

    Redirects

    I have a web app that works fine on the development machine and on several
    servers running Win2k IIS 5 and Windows2003 IIS 6. But I am having an issue
    on one particular erver running Win2k IIS 5, but has an Apache server
    sending redirects to this server.

    My problem is when I try to do a

    Response.Redire ct ("~/somepage.aspx")

    The page calling the Response.Rediec t is in the same directory as the
    somepage.aspx, but I get 404 Page Not Found Error. This happens everytime.
    The test app I was working with was as simple as having two web forms, and
    in the page load of the first have the redirct to the other.

    Another piece of info that may be of relevance is that the web app is
    running on port 90 because the Apache runs on 80. The Apache configuration
    file looks something like

    Proxypass /dw/ http://machine.company.location.md.us:90/
    ProxyPassrevers e /dw/ http://machine.company.location.md.us:90/

    So www.mainsite.com/dw/ would redirect to my server using port 90.

    Also the application runs fine if ran from the server itself. I only have
    the problem when accessing the app over the internet through the Apache
    server.

    Any help would be greatly appreciated.

    Thanks



  • Bruce Barker

    #2
    Re: Redirects

    when you use Response.Redire ct, by default asp.net generates a fully
    qualified url. in your case

    Response.Redire ct ("~/somepage.aspx")

    returns:



    which is bypassing the proxy. you should turn off fully qualified redirects
    in the HttpRuntimeSect ion. once you turn it off I don't believe ~ operator
    will work, you will have to do relative redirects.

    -- bruce (sqlwork.com)





    "Stan Canepa" <scanepa@docksi desoftware.com> wrote in message
    news:OoMQg5cSGH A.792@TK2MSFTNG P10.phx.gbl...[color=blue]
    >I have a web app that works fine on the development machine and on several
    > servers running Win2k IIS 5 and Windows2003 IIS 6. But I am having an
    > issue
    > on one particular erver running Win2k IIS 5, but has an Apache server
    > sending redirects to this server.
    >
    > My problem is when I try to do a
    >
    > Response.Redire ct ("~/somepage.aspx")
    >
    > The page calling the Response.Rediec t is in the same directory as the
    > somepage.aspx, but I get 404 Page Not Found Error. This happens
    > everytime.
    > The test app I was working with was as simple as having two web forms, and
    > in the page load of the first have the redirct to the other.
    >
    > Another piece of info that may be of relevance is that the web app is
    > running on port 90 because the Apache runs on 80. The Apache configuration
    > file looks something like
    >
    > Proxypass /dw/ http://machine.company.location.md.us:90/
    > ProxyPassrevers e /dw/ http://machine.company.location.md.us:90/
    >
    > So www.mainsite.com/dw/ would redirect to my server using port 90.
    >
    > Also the application runs fine if ran from the server itself. I only have
    > the problem when accessing the app over the internet through the Apache
    > server.
    >
    > Any help would be greatly appreciated.
    >
    > Thanks
    >
    >
    >[/color]


    Comment

    • Joerg Jooss

      #3
      Re: Redirects

      Thus wrote Stan,
      [color=blue]
      > I have a web app that works fine on the development machine and on
      > several servers running Win2k IIS 5 and Windows2003 IIS 6. But I am
      > having an issue on one particular erver running Win2k IIS 5, but has
      > an Apache server sending redirects to this server.
      >
      > My problem is when I try to do a
      >
      > Response.Redire ct ("~/somepage.aspx")
      >
      > The page calling the Response.Rediec t is in the same directory as the
      > somepage.aspx, but I get 404 Page Not Found Error. This happens
      > everytime. The test app I was working with was as simple as having two
      > web forms, and in the page load of the first have the redirct to the
      > other.
      >
      > Another piece of info that may be of relevance is that the web app is
      > running on port 90 because the Apache runs on 80. The Apache
      > configuration file looks something like
      >
      > Proxypass /dw/ http://machine.company.location.md.us:90/
      > ProxyPassrevers e /dw/ http://machine.company.location.md.us:90/
      >
      > So www.mainsite.com/dw/ would redirect to my server using port 90.
      >
      > Also the application runs fine if ran from the server itself. I only
      > have the problem when accessing the app over the internet through the
      > Apache server.[/color]

      Running a proxy like Fiddler (www.fiddlertool.com) should reveal the problem.
      What I think happens is that
      Response.Redire ct ("~/somepage.aspx")
      produces something like
      HTTP/1.1 302 Found
      Server: Microsoft-IIS/5.1
      Date: Fri, 17 Mar 2006 17:44:04 GMT
      X-Powered-By: ASP.NET
      X-AspNet-Version: 2.0.50727
      Location: /<YourApplicatio nRoot>/somepage.aspx

      That would be wrong: It doesn't access the rewritten path /dw/. I can actually
      create a similar issue by just using another redirection virtual directory
      in IIS. The fix is to create the redirect location manually.

      Cheers,
      --
      Joerg Jooss
      news-reply@joergjoos s.de


      Comment

      • Joerg Jooss

        #4
        Re: Redirects

        Thus wrote Bruce,
        [color=blue]
        > when you use Response.Redire ct, by default asp.net generates a fully
        > qualified url. in your case
        >
        > Response.Redire ct ("~/somepage.aspx")
        >
        > returns:
        >
        > http://machine.company.location.md.u.../somepage.aspx
        >
        > which is bypassing the proxy. you should turn off fully qualified
        > redirects in the HttpRuntimeSect ion. once you turn it off I don't
        > believe ~ operator will work, you will have to do relative redirects.[/color]

        Are you sure? According to MSDN and my own observations, it's set to false
        by default. Anyway, it's a better approach than constructing the URL manually,
        but there may be situations in which it cannot be avoided.

        Cheers,
        --
        Joerg Jooss
        news-reply@joergjoos s.de


        Comment

        • Stan Canepa

          #5
          Re: Redirects

          I was looking information up on
          HttpRuntimeSect ion.UseFullyQua lifiedRedirectU rl and have found that it is
          new to the .Net Framework version 2. The site was written in VS 2003
          framework version 1.1.4322. I have a feeling you are right about the path.
          Any other ideas about how I might go about fixing the issue? Do you think
          Transfer would work?


          "Bruce Barker" <brubar_nospamp lease_@safeco.c om> wrote in message
          news:O%23V2ozeS GHA.2300@TK2MSF TNGP11.phx.gbl. ..[color=blue]
          > when you use Response.Redire ct, by default asp.net generates a fully
          > qualified url. in your case
          >
          > Response.Redire ct ("~/somepage.aspx")
          >
          > returns:
          >
          > http://machine.company.location.md.u.../somepage.aspx
          >
          > which is bypassing the proxy. you should turn off fully qualified[/color]
          redirects[color=blue]
          > in the HttpRuntimeSect ion. once you turn it off I don't believe ~ operator
          > will work, you will have to do relative redirects.
          >
          > -- bruce (sqlwork.com)
          >
          >
          >
          >
          >
          > "Stan Canepa" <scanepa@docksi desoftware.com> wrote in message
          > news:OoMQg5cSGH A.792@TK2MSFTNG P10.phx.gbl...[color=green]
          > >I have a web app that works fine on the development machine and on[/color][/color]
          several[color=blue][color=green]
          > > servers running Win2k IIS 5 and Windows2003 IIS 6. But I am having an
          > > issue
          > > on one particular erver running Win2k IIS 5, but has an Apache server
          > > sending redirects to this server.
          > >
          > > My problem is when I try to do a
          > >
          > > Response.Redire ct ("~/somepage.aspx")
          > >
          > > The page calling the Response.Rediec t is in the same directory as the
          > > somepage.aspx, but I get 404 Page Not Found Error. This happens
          > > everytime.
          > > The test app I was working with was as simple as having two web forms,[/color][/color]
          and[color=blue][color=green]
          > > in the page load of the first have the redirct to the other.
          > >
          > > Another piece of info that may be of relevance is that the web app is
          > > running on port 90 because the Apache runs on 80. The Apache[/color][/color]
          configuration[color=blue][color=green]
          > > file looks something like
          > >
          > > Proxypass /dw/ http://machine.company.location.md.us:90/
          > > ProxyPassrevers e /dw/ http://machine.company.location.md.us:90/
          > >
          > > So www.mainsite.com/dw/ would redirect to my server using port 90.
          > >
          > > Also the application runs fine if ran from the server itself. I only[/color][/color]
          have[color=blue][color=green]
          > > the problem when accessing the app over the internet through the Apache
          > > server.
          > >
          > > Any help would be greatly appreciated.
          > >
          > > Thanks
          > >
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...