HTTP Referrer (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


BeTheBall -> HTTP Referrer (8/29/2003 16:37:37)

Can I use the http referrer to prevent users from accessing a certain page without clicking a link on another page? In other words, I have two pages, Page1 and Page2. I don't want anyone to access Page1 w/o going through Page2. I am guessing I can write code that will allow access if the referring page is Page1 and redirect if not, just not sure of the syntax.




bobby -> RE: HTTP Referrer (8/29/2003 17:12:57)

Or...

Set up a link from the "required page" to the other, and pass a string value...

<a href="page2.asp?foo=yes">Click here</a>

... then at the top of page2.asp...

<%
response.buffer=true

if request.querystring("foo")<>"yes" then
response.redirect ("page1.asp")
else
end if
%>

Now, in order to visit page2.asp, you have to be coming from the link on page1.asp...




Spooky -> RE: HTTP Referrer (8/29/2003 18:04:03)

http referer is not always guaranteed, but you vould use it - request.servervariables("http_referer")
Another option (again not always available if cookies are blocked) is to set a session when they have visited the page and check it on entry to the page 2




Doug G -> RE: HTTP Referrer (8/29/2003 21:20:16)

If you do use it don't spell referrer properly. From way back when HTTP_REFERER has been misspelled :)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125