|
Home > Archive > IIS ASP > March 2006 > Response.Redirect not changing URL?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Response.Redirect not changing URL?
|
|
|
| In file FIRST.ASP, I've got
<%
Response.Redirect "SECOND.ASP"
%>
The redirect is happening, and I'm seeing the content from SECOND.ASP in the browser,
but the URL in the browser is still saying FIRST.ASP.
Does anyone know why this is happening and how I can insure the browser displays
SECOND.ASP? I'm using IE6.
THANKS,
-Bill.
| |
| Bob Barrows [MVP] 2006-03-21, 5:56 pm |
| Bill wrote:
> In file FIRST.ASP, I've got
> <%
> Response.Redirect "SECOND.ASP"
> %>
>
> The redirect is happening, and I'm seeing the content from SECOND.ASP
> in the browser, but the URL in the browser is still saying FIRST.ASP.
>
> Does anyone know why this is happening
That's just the way it works. A Redirect does not change the name of the
page that was requested ...
> and how I can insure the browser displays SECOND.ASP? .
The browser has to request SECOND.ASP in order for that to appear in the
address bar. Server-side code cannot alter this.
What you can do is redirect to an intermediate page that uses client-side
code to navigate to SECOND.ASP
> I'm using IE6
Irrelevant.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
| |
|
|
"Bob Barrows [MVP]" wrote...
> Bill wrote:
>
> That's just the way it works. A Redirect does not change the name of the
> page that was requested ...
Are confusing this with Server.Transfer? That does not change the URL of the browser
because it redirects the SERVER to the new page.
Response.Redirect, according to Microsoft, "redirects a CLIENT to a new URL". In the
past, it has always changed the URL for me. This is why Response.Redirect can be used to
redirect to another server (Server.Transfer cannot).
http://msdn.microsoft.com/library/e...
opic.asp
http://msdn.microsoft.com/library/e...b7f38f37ab3.asp
>
> The browser has to request SECOND.ASP in order for that to appear in the
> address bar. Server-side code cannot alter this.
Response.Redirect does this:
http://msdn.microsoft.com/library/e...b7f38f37ab3.asp
"this method does send other HTTP headers set by this page indicated by the original URL
to the client."
That's why Response.Redirect is less efficient than Server.Transfer, because ST doesn't
communicate with the client, RD does.
> What you can do is redirect to an intermediate page that uses client-side
> code to navigate to SECOND.ASP
>
> Irrelevant.
The browser URL changes in Firefox.
| |
| Evertjan. 2006-03-21, 5:56 pm |
| Bill wrote on 21 mrt 2006 in microsoft.public.inetserver.asp.general:
>
> Are confusing this with Server.Transfer? That does not change the URL
> of the browser because it redirects the SERVER to the new page.
>
> Response.Redirect, according to Microsoft, "redirects a CLIENT to a
> new URL".
You are so right.
> That's why Response.Redirect is less efficient than Server.Transfer,
> because ST doesn't communicate with the client, RD does.
The nice thing about Server.Transfer is,
that you don't need no client anymore.
[For the second file's excution, that is]
Clients are a nuisance, both they and their diverse browsers heavily
interfere with perfect web scripting.
I can imagine a NG especially for unserved serverside scripting.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
| |
| Bob Barrows [MVP] 2006-03-21, 5:56 pm |
| Bill wrote:
> Are confusing this with Server.Transfer? That does not change the URL
> of the browser because it redirects the SERVER to the new page.
>
Yes I goofed.
I just ran some tests on my server, and the url changes as it is supposed to
(using IE6)
There aren't any frames involved are there?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
| |
| Ray Costanzo [MVP] 2006-03-22, 2:48 am |
| I've seen in the past that if I'm on page1.asp, and I had a server-side
error before the redirect, corrected the error, refreshed, IE would display
the old URL even after the redirect. After closing the browser and going
through the page again, it would redirect and show in the address bar as
expected.
Ray at home
"Bill" <Bill541@yahoo.com> wrote in message
news:uCcVUoSTGHA.4520@TK2MSFTNGP10.phx.gbl...
> In file FIRST.ASP, I've got
> <%
> Response.Redirect "SECOND.ASP"
> %>
>
> The redirect is happening, and I'm seeing the content from SECOND.ASP in
> the browser,
> but the URL in the browser is still saying FIRST.ASP.
>
> Does anyone know why this is happening and how I can insure the browser
> displays
> SECOND.ASP? I'm using IE6.
>
> THANKS,
>
> -Bill.
>
>
| |
| Evertjan. 2006-03-25, 11:58 am |
| Ray Costanzo [MVP] wrote on 22 mrt 2006 in
microsoft.public.inetserver.asp.general:
> I've seen in the past that if I'm on page1.asp, and I had a
> server-side error before the redirect, corrected the error, refreshed,
> IE would display the old URL even after the redirect. After closing
> the browser and going through the page again, it would redirect and
> show in the address bar as expected.
>
I think MS got that fixed, as I didn't see that the last months.
[or, doubtfull, my programming has become better]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
| |
|
|
"Bob Barrows [MVP]" wrote..
> Bill wrote:
> Yes I goofed.
I do that a lot...
>
> I just ran some tests on my server, and the url changes as it is supposed to
> (using IE6)
> There aren't any frames involved are there?
No, no frames. It's part of a security check application - first.asp does some security
checking, then sets a few session variables & then does a Response.Redirect to
second.asp. I'd really like the file name of first.asp to be secret - they can't do any
real damage to my security (I don't thnk!), but every time first.asp is refreshed, it
logs data info to a text file.
While I can certainly eliminate the duplicate logging, that's just fixing the symptom,
and not the cause.
Bill.
| |
| Dave Anderson 2006-03-25, 11:58 am |
| Evertjan. wrote:
> I think MS got that fixed, as I didn't see that the last
> months. [or, doubtfull, my programming has become better]
I still see it periodically in IE. I have never tried to figure out the
reason. Probably because I just don't care what a URL looks like as long as
it functions.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
| |
| Kyle Peterson 2006-03-25, 11:58 am |
| well, its a cobb but here is an idea.
run your 1st asp page, redirect them to another page that does a quick
meta-redirect to the 2nd asp page
pretty sure that will solve the problem of them not seing the 1st page url
in the browser when it is all said and done...
"Dave Anderson" <GTSPXOESSGOQ@spammotel.com> wrote in message
news:u7toYbeTGHA.4740@TK2MSFTNGP14.phx.gbl...
> Evertjan. wrote:
>
> I still see it periodically in IE. I have never tried to figure out the
> reason. Probably because I just don't care what a URL looks like as long
> as it functions.
>
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message.
> Use of this email address implies consent to these terms. Please do not
> contact me directly or ask me to contact you directly for assistance. If
> your question is worth asking, it's worth posting.
>
| |
| Kyle Peterson 2006-03-25, 11:58 am |
| and I meant to type meta-refresh
"Kyle Peterson" <kyle342@hotmail.com> wrote in message
news:uOIXrzeTGHA.5884@TK2MSFTNGP14.phx.gbl...
> well, its a cobb but here is an idea.
>
> run your 1st asp page, redirect them to another page that does a quick
> meta-redirect to the 2nd asp page
> pretty sure that will solve the problem of them not seing the 1st page url
> in the browser when it is all said and done...
>
>
>
>
> "Dave Anderson" <GTSPXOESSGOQ@spammotel.com> wrote in message
> news:u7toYbeTGHA.4740@TK2MSFTNGP14.phx.gbl...
>
>
|
|
|
|
|