Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

response.redirect not working ?

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
0
0
CA
i have a button on page1 that calls to page2 which produces a csv file. i'm redirect to page2 but dont actually leave the originating page, hence the csv is produced by another asp but the url doesnt change to the page2, and the redirect in that apage2 doesn't instantiate. WHY?

Example:

::page1.asp::

I'm posting the buttons back to the page and have this at the top:

If Request.Form("qaz") = "csv" Then
Call SendResults()
ElseIf Request.Form("qaz") = "ALLcsv" Then
response.redirect "viewLists1.asp" ' IF I CHANGE THIS TO ANOTHER PAGE IT DOES REDIRECT TO IT
End If

::viewLists1.asp:: ' CSV GETS CREATED SUCCESSFULLY (WITH VALUES)


... END OF CODE:

Code:
			objRS.MoveNext()
		Loop

Response.End

	objRS.Close()
	Set objRS = Nothing
%>

<% 
response.redirect "viewList2.asp" 
%>


AFTER I GET PROmpted to save the csv, and i do save it to my desktop, i do not get redirected to "viewList2.asp"

any suggestions
 
Nothings going to happen after Response.End, cause Response.End means exactly that, we are done , we aint going to do any more.

" ...i'm redirect to page2 but dont actually leave the originating page... "

Response.redirect is executed on the server after the browser sent a request for the ASP script containing that statement. The browser will continue to display whatever page requested the ASP script until the server fulfills the request.

The request was for some "page", maybe page1.asp. As the ASP processor works its way through the script known as page1.asp it builds a stream resembling a web page, a csv file, or whatever.

But before it is finished it may encounter a Response.redirect statement. At that point it gives up on the stream it was building and starts over, executing the "page" mentioned in the Response.redirect. Eventually the ASP processor will finish and the stream it was building will be sent to the browser, at which point we will see a new page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top