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!

Identify the previous page. 1

Status
Not open for further replies.

crabgrass

Technical User
Aug 29, 2007
111
US
Suppose page1 and page2 each have a button that loads page3. Is there a way for page3 to determine which of the 2 pages called it so we can set some variables based on which of the pages loaded the 3rd?

Thanks
 
Code:
If Request.ServerVariables("HTTP_REFERER") = "[URL unfurl="true"]www.someurl.com/whatever.html"[/URL] Then
	X = 1
Else
	X = 4
End If

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 


As some browsers don't send the HTTP_REFERER you may not get that server variable populated. There are also other ways to get to the 3rd form other than clicking a link. Annoying, but a fact of life.

So, if you want to be 99% sure, then I suggest that you include a querystring parameter passed from each page.

e.g. Form1.asp --> Form2.asp?frompage=1

Additionally if you have a requirement to ensure that only these pages can click through to this page, then use session variables to hold the last requested page so you can check to see if that was set (or other actions met of cours) before allowing page 3 to execute.



A smile is worth a thousand kind words. So smile, it's easy! :)
 
damber, glad to see they reactivated your account ;)

well-put, i gave you some purple love. and not in the sick way.

----
star.gif
 
damber -

That's exactly what I've been doing. I was just wondering if there was a more generic way.

Thanks
 

cheers cory :) glad to have remembered my password ! :)

crabgrass, there are a couple of different ways, but this is probably the simplest and most effective for your requirements. Unfortunately http is fundamentally a stateless protocol so either the framework or app has to build that state into the solution..

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top