There may be a time when you have certain .ASP pages that you only want people to be able to access when going through your site. You don't want other websites to link directly to these pages (for example, you may want a user to have filled out a lengthy form before arriving at a certain page). It's not difficult to protect your ASP pages this way. We will use the Request.ServerVariables collection to perform this task.
At the top of the .ASP page that you want "protected" put this code:
<% if left(Request.ServerVariables("HTTP_REFERER"),24) <> "http://www.yoursite.com/" and _ Request.ServerVariables("HTTP_REFERER") <> "" then 'We used Request.ServerVariables to get the domain name 'of the referring web page. 'If the domain name doesn't equal my domain name, then 'I want to send the user to some other site Response.Redirect "http://www.yahoo.com" end if %>
At the top of your ASP page put this code:
<% if Request.ServerVariables("REMOTE_HOST") <> "184.108.40.206" and _ Request.ServerVariables("REMOTE_HOST") <> "" then 'Send them away, if you like Response.Redirect "http://www.yahoo.com" end if %>