Redirects

S

Stan Canepa

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
 
B

Bruce Barker

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)
 
J

Joerg Jooss

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,
 
J

Joerg Jooss

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,
 
S

Stan Canepa

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top