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

HTTP_REFERER not working!! HELP!!!

Status
Not open for further replies.

YvonneTsang

Programmer
Sep 28, 2001
37
CA
I am trying to learn how to use HTTP_REFERER properly. I have a basic test site that is using it with the following code.

<%
ThisURL = Request.ServerVariables( &quot;URL&quot; )

PrevURL = Request.ServerVariables(&quot;http_referer&quot;)



Response.Write( &quot;This URL = &quot; & ThisURL & &quot;<br>&quot;)
Response.Write( &quot;Prev URL = &quot; & PrevURL & &quot;<br>&quot;)
%>

The referer is not giving me a value

the results when I go to the page is

This URL = /test.asp
Prev URL =

Can someone help me with this problem?
 
try this
<%
ThisURL = Request.ServerVariables( &quot;URL&quot; )

PrevURL = request.servervariables(&quot;HTTP_REFERER&quot;)


Response.Write( &quot;This URL = &quot; & ThisURL & &quot;<br>&quot;)
Response.Write( &quot;Prev URL = &quot; & PrevURL & &quot;<br>&quot;)
%>

as you can see I used upper case in the server variable request. A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Are you using a link to get to the page? If you are typing the name in the address bar, there is no referrer...
-- What did you expect? This is FREE advice. LOL[ponder]
 
I should have mentioned also that you should be in the habit of using the correct syntax for everything in your code. I made a error in my post and taht is why I am telling you.
what I'm saying is
this
PrevURL = request.servervariables(&quot;HTTP_REFERER&quot;)
Is not a good habit to get into, the proper syntax is
PrevURL = Request.ServerVariables(&quot;HTTP_REFERER&quot;)

Seeing as VBScript is not case sensitive MOST of the time you can and most likely will get away with not caring too much about it, BUT coding conventions are in place for a reason and you should follow them. Sometimes a lower case R can bit you when you least expect it.
[thumbsup2] A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top