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!

preventing bookmarking an asp page

Status
Not open for further replies.

dmaytum

Programmer
Mar 4, 2003
23
US
Is there an option somewhere to prevent a user from bookmarking an asp web page. I only want them to enter the web site from the home page. I don't want them getting several pages deep into the web site, bookmarking that page and using the bookmark to get into the web site next time.
 
I just use some basic security so they have to log in to get anywhere.
 
You can't stop them from bookmarking it, but the simplest way to keep people from entering a page from outside your site (that I'm aware of) it to put this at the top of the page:
Code:
If Left(Requst.Servervariables("HTTP_REFERER"), 27) <> "[URL unfurl="true"]http://www.yourSiteName.com"[/URL] Then
    Response.Redirect("yourStartingPage.asp")
End If
You'd change the " string to your actual domain name, change the number 27 to the actual length of the domain name string (including the " and change the "yourStartingPage.asp" to whatever "first" page you want the user to begin at.

Bookmarked pages have blank HTTP_REFERERs, so it will redirect to the "start" page. Links on other sites (including search engines) will have some other referer. Only links from within your site will not be redirected.

That should do what you need.

If you want to be super-strict -- you want to only be able to reach a page from one specific other page -- then you'd just change the If statement to look like this:
Code:
If Requst.Servervariables("HTTP_REFERER") <> "[URL unfurl="true"]http://www.yourSiteName.com/yourSpecificPage.asp"[/URL] Then
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top