How do I pass the QueryString in ASP with a Redirect?

I am attempting to do the following:

I have an html page that has a form the user fills out. When the user hits the submit button I POST the query string to an ASP. What I would like that ASP to do is display a message to the client, write the form information to a database, and then redirect the client to another ASP that will give the user the opportunity to print a copy of the form he/she just filled out.

I’m a little confused on how to pass the Request object’s query string to the page that will allow the client to print the information. So I guess to put my first question in a nutshell I could ask it as follows:

“How do I pass the querystring from the first page a client accesses to the third page the client accesses using a redirect within the second page?
Who is Participating?
sybeConnect With a Mentor Commented:
There are at least 2 ways to do this:

method 1.

1st page = form

2d page:
'first your code to store info into database

'the following line will pass the form data as a querystring
'to the third page
Response.redirect("thirdpage.asp?" & Request.Form)

It might be that there will be too much data to put into a querystring (especially when the form contains Textareas)

Then use method 2:

method 2.

' secondpage.asp
' your code to put data into the database
' make sure you retrieve the id (autonumber) from the new record

Response.redirect("thirdpage.asp?id=" & newID)


' third page
' retrieve the data again from the database, using the id you
' have in the recordset

'display the data


Note: Response.redirect works only when NO response is send to the browser, not even "<HTML>", so make sure that the second page has only code between <% and %>.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.