Redirects

Discussion in 'ASP .Net' started by Stan Canepa, Mar 17, 2006.

  1. Stan Canepa

    Stan Canepa Guest

    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.Redirect ("~/somepage.aspx")

    The page calling the Response.Rediect 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/
    ProxyPassreverse /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
     
    Stan Canepa, Mar 17, 2006
    #1
    1. Advertising

  2. Stan Canepa

    Bruce Barker Guest

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

    Response.Redirect ("~/somepage.aspx")

    returns:

    http://machine.company.location.md.us:90/myvdir/somepage.aspx

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

    -- bruce (sqlwork.com)





    "Stan Canepa" <> wrote in message
    news:...
    >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.Redirect ("~/somepage.aspx")
    >
    > The page calling the Response.Rediect 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/
    > ProxyPassreverse /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, Mar 17, 2006
    #2
    1. Advertising

  3. Stan Canepa

    Joerg Jooss Guest

    Thus wrote Stan,

    > 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.Redirect ("~/somepage.aspx")
    >
    > The page calling the Response.Rediect 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/
    > ProxyPassreverse /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.


    Running a proxy like Fiddler (www.fiddlertool.com) should reveal the problem.
    What I think happens is that
    Response.Redirect ("~/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: /<YourApplicationRoot>/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
     
    Joerg Jooss, Mar 17, 2006
    #3
  4. Stan Canepa

    Joerg Jooss Guest

    Thus wrote Bruce,

    > when you use Response.Redirect, by default asp.net generates a fully
    > qualified url. in your case
    >
    > Response.Redirect ("~/somepage.aspx")
    >
    > returns:
    >
    > http://machine.company.location.md.us:90/myvdir/somepage.aspx
    >
    > which is bypassing the proxy. you should turn off fully qualified
    > redirects in the HttpRuntimeSection. once you turn it off I don't
    > believe ~ operator will work, you will have to do relative redirects.


    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
     
    Joerg Jooss, Mar 17, 2006
    #4
  5. Stan Canepa

    Stan Canepa Guest

    I was looking information up on
    HttpRuntimeSection.UseFullyQualifiedRedirectUrl 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" <> wrote in message
    news:O%...
    > when you use Response.Redirect, by default asp.net generates a fully
    > qualified url. in your case
    >
    > Response.Redirect ("~/somepage.aspx")
    >
    > returns:
    >
    > http://machine.company.location.md.us:90/myvdir/somepage.aspx
    >
    > which is bypassing the proxy. you should turn off fully qualified

    redirects
    > in the HttpRuntimeSection. once you turn it off I don't believe ~ operator
    > will work, you will have to do relative redirects.
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    >
    >
    > "Stan Canepa" <> wrote in message
    > news:...
    > >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.Redirect ("~/somepage.aspx")
    > >
    > > The page calling the Response.Rediect 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/
    > > ProxyPassreverse /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
    > >
    > >
    > >

    >
    >
     
    Stan Canepa, Mar 17, 2006
    #5
    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. Mark
    Replies:
    0
    Views:
    305
  2. Gery D. Dorazio
    Replies:
    0
    Views:
    460
    Gery D. Dorazio
    Jan 29, 2004
  3. darrel

    Postback confusion re: redirects

    darrel, May 4, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    764
    darrel
    May 4, 2004
  4. www.MSmobiles.com
    Replies:
    1
    Views:
    370
    Teemu Keiski
    Jul 18, 2004
  5. Replies:
    1
    Views:
    321
    Nicole Calinoiu
    Feb 2, 2005
Loading...

Share This Page