We help IT Professionals succeed at work.

Variable which can detect which webpage do you came from

jilim
jilim asked
on
Hie Experts....

In ASP, is there any server variables which can detect previously where do u came from?...example as below:

You are in first.asp and there is a link to second.asp. And in second.asp, it can detect that you are from first.asp.

If in third.asp also have a link to second.asp and you came to second.asp through third.asp, in second.asp 's server variable can detect you came from third.asp.

Is there any server varibales or any method that can detect previously you are visiting a page before came to the current page?

Thanx Experts.....hope that i can get the feedback ASAP!!

Cheers,
Jimmy
Comment
Watch Question

Commented:
<% Response.Write Request.ServerVariables("HTTP_REFERER") %>

This will show the page you got to this page from. If you clicked a link and got to the current page, there will be something there. If you typed in the URL, it will be blank.

Author

Commented:
Hie Fenatu,

I did try on HTTP_Referer, but it returns me blank. Any ideas on it??...beside this is there any otehr method??
Thanx

Commented:
You have that line in the second.asp and clicked a link in first.asp to go to second.asp?

Author

Commented:
Hie Fenatu,

I did try on HTTP_Referer, but it returns me blank. Any ideas on it??...beside this is there any otehr method??
Thanx

Author

Commented:
Yeah....this line "<% Response.Write Request.ServerVariables("HTTP_REFERER") %>" i put it in second.asp.  so whenever first.asp or third.asp came...it still return blank to me.
Any idea???

Author

Commented:
Yeah....this line "<% Response.Write Request.ServerVariables("HTTP_REFERER") %>" i put it in second.asp.  so whenever first.asp or third.asp came...it still return blank to me.
Any idea???

Commented:
But is it showing which page you came from in second.asp?
Mark FranzProject Manager
CERTIFIED EXPERT

Commented:
Look at the Javascript property referrer;

referrer Property

If a destination document is reached by a user clicking on a Link object in another document (the referrer), this property returns the referring document's URL.

Syntax: document.referrer

<script language="Javascript">
<!--

if (document.referrer&&document.referrer!="")
  document.write('Thanks for visiting this site from '+document.referrer+'<BR>');

//-->
</script>



Author

Commented:
Hie mgfranz...

Thanx it works!..... but unfortunately it's in JavaScript. Can transfer the value (document.referrer) to ASP format?? how??

thanx
Project Manager
CERTIFIED EXPERT
Commented:
Since JavaScript runs client-side, you will have to put it in a hidden form var in order to use it in server-side processing;

<script language="Javascript">
<!--

if (document.referrer&&document.referrer!="")
 var theRef = document.referrer;

//-->
</script>




<form>
<input type="hidden" value="javascript(theRef)">
</form>

I'm sure there are other ways, but it's to early...

Author

Commented:
thanx mgfranz...

but i'm still looking for a better solutions.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.