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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to go to a different page in asp?

Status
Not open for further replies.

wvdba

IS-IT--Management
Jun 3, 2008
465
US
hi.
i have a page (page1.asp) with two input text boxes in a form with post method and a submit button.
the submit button's action is the page itself (page1.asp)
the goal is to check the value of box1 and box2
if box1 = box2 then
go to page3
else
go to page4
is this possible?
thanks.
 
Code:
if box1 = box2 then
   response.redirect("page3.asp")
else
   response.redirect("page4.asp")
End If

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
gmmastros,
thanks. redirect is the command i didn't know.
thank you so much.
 
You're welcome.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
i tried the above method and it worked. my questions is that can i pass variables with the redirect method? i like to pass at least one variable to page3.asp and page4.asp. is it possible?
thanks.
 
pass them through the querystring:

Code:
response.redirect page3.asp?myFirstVar=myFirstValue&mySecondVar=mySecondValue


or set a session before redirecting and use that session on the next page

Code:
session("myFirstVar") = myFirstValue
session("mySecondVar") = mySecondValue
response.redirect page3.asp


--------

GOOGLE is a great resource to find answers to questions like "how do i..."


--------
 
redirect does not keep session id. when you go to the new page, the session is gone.
 
the strange thing about redirect is that if the variable is set to a constant like this in page1.asp:
parm = "123"
response.redirect ("Pagea.asp?parm=" & parm)
it works.

request.querystring("parm")
response.write parm
response.redirect ("Pagea.asp?parm=" & parm)
in page2.asp
parm = Server.HTMLEncode(Request("parm"))
response.write parm
shows up as blank
when the parm is passed from a previous page and obtained via request.querystring and verified and printed, then the above code doesn't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top