469,352 Members | 2,026 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Alternative to Response.Redirect

I'm looping through an array of employee numbers and
sending them to an Oracle procedure for processing. While
I'm doing this I'm updating a <DIV> tag in the browser
with index number of the current array item so the user
knows how far along in processing we are. The ASP looks
something like this:

<div id=messageToUserTxT>Please wait...</div>

<%
For i = LBound(arrayOfEmployeeNumbers) To _
UBound(arrayOfEmployeeNumbers)

'...Generate and execute SQL
cn.execute SQL

%>
<script language=javascript>
document.getElementById('messageToUserTxT').innerT ext
= 'Processing <%=i%> of <%=UBound(arrayOfEmployeeNumbers)%
';

</script>
<%
Response.flush()
Next
%>

This does exactly what I want it to do, but I now get this
error when I try and redirect the user to another page
when the processing is complete:
The HTTP headers are already written to the client
browser. Any HTTP header modifications must be made
before writing page content
According to some posts I've seen in the forum this
happens because I've already written some HTML to the
browser.

I was wondering therefore if there is any way I could
redirect the user to the next page using some other
mechanism? I seem to recall an alternative to using
Response.Redirect, but I cant remember what it is!

Any ideas?

Thanks,

Colin
Jul 22 '05 #1
5 11235
You'd have to use a client-side "alternative" such as:

location.href='someotherpage.asp';

Ray at work
"Colin Steadman" <an*******@discussions.microsoft.com> wrote in message
news:70****************************@phx.gbl...

I was wondering therefore if there is any way I could
redirect the user to the next page using some other
mechanism? I seem to recall an alternative to using
Response.Redirect, but I cant remember what it is!

Jul 22 '05 #2
Ray Costanzo [MVP] wrote on 16 nov 2004 in
microsoft.public.inetserver.asp.general:
"Colin Steadman" <an*******@discussions.microsoft.com> wrote in message
news:70****************************@phx.gbl...

I was wondering therefore if there is any way I could
redirect the user to the next page using some other
mechanism? I seem to recall an alternative to using
Response.Redirect, but I cant remember what it is!


You'd have to use a client-side "alternative" such as:

location.href='someotherpage.asp';


Strange as it seems

Response.redirect 'someotherpage.asp'

is in fact a clientside action.
Only a browser understanding the header directive,
will execute that code and redirect.
However

Server.transfer 'someotherpage.asp'

is strictly serverside.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 22 '05 #3
>-----Original Message-----
You'd have to use a client-side "alternative" such as:

location.href='someotherpage.asp';

Ray at work

OK, thankyou Ray.

Colin
Jul 22 '05 #4
>
Server.transfer 'someotherpage.asp'

is strictly serverside.

Aha! Thats what I was looking for.

However I've since incorporated 'someotherpage.asp' into
the processing one, and it seems to work rather well.

But thanks anyway.

Colin
Jul 22 '05 #5
http://www.aspfaq.com/2011
http://www.aspfaq.com/2217

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Colin Steadman" <an*******@discussions.microsoft.com> wrote in message
news:70****************************@phx.gbl...
I'm looping through an array of employee numbers and
sending them to an Oracle procedure for processing. While
I'm doing this I'm updating a <DIV> tag in the browser
with index number of the current array item so the user
knows how far along in processing we are. The ASP looks
something like this:

<div id=messageToUserTxT>Please wait...</div>

<%
For i = LBound(arrayOfEmployeeNumbers) To _
UBound(arrayOfEmployeeNumbers)

'...Generate and execute SQL
cn.execute SQL

%>
<script language=javascript>
document.getElementById('messageToUserTxT').innerT ext
= 'Processing <%=i%> of <%=UBound(arrayOfEmployeeNumbers)%
';

</script>
<%
Response.flush()
Next
%>

This does exactly what I want it to do, but I now get this
error when I try and redirect the user to another page
when the processing is complete:
The HTTP headers are already written to the client
browser. Any HTTP header modifications must be made
before writing page content
According to some posts I've seen in the forum this
happens because I've already written some HTML to the
browser.

I was wondering therefore if there is any way I could
redirect the user to the next page using some other
mechanism? I seem to recall an alternative to using
Response.Redirect, but I cant remember what it is!

Any ideas?

Thanks,

Colin

Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul | last post: by
6 posts views Thread by Sam | last post: by
3 posts views Thread by Sehboo | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.