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

window.history

Status
Not open for further replies.

yogi77

Programmer
Oct 12, 2001
25
0
0
GB
Is there a server-side equivalent to window.history.go(-1).

I could use response.redirect("URL"), however the "URL" requires the user to input an ID and I really don't want to ask them again.

TIA,
Yogi

 
store this id in an session variable... ________
George, M
 
Thanks for your reply George,

Unfortunately I'm still a bit stuck.

I have tried the following but without success;

partid=session("partid")
Response.redirect "testpage.asp?partid=" & partid

but the page only performs the standard error check to prompt for partid?

Any ideas?

Thanks
Yogi
 
if the page defaults to prompting for the partid, then you have to add code around that in the case that the partid is in the querystring, ie.:

If Request.QueryString("partid") = "" Then
' do your partid prompt
End If

' continue with processing
 
why use a query string? If partid stays the same for the user throughout the session, store it's value in a session variable and just redirect. using query strings gets messy stay with the post method. You can also store the partid in a hidden form field with javascript before submitting the page. then access that form field on the redirected page.
 
If you just want to go back to the page that requested the ASP page do this:

Response.Redirect(Request.ServerVariables("HTTP_REFERER"))

The Request.ServerVariables("HTTP_REFERER") contains the page with the link (or whatever) the user used to get to the current ASP page. Note that this is not the same as the JavaScript function exactly. Using the JavaScript will in effect click the back button. Everything on the previous page will still be there (all filled in forms etc). Using the ServerVariables will send the user back to the previous page, but it will be a new refreshed version of that page.

Hope that helps. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
Thanks everyone for your help!

I implemented the servervariable suggestion posted by Harold and I got just what I wanted!

Thanks Again,

Yogi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top