CodeAve.com CodeAve.com - ASP - Server Variables
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Referring Page Source
Stop bad input before it gets into your applications. Typically, form actions to your applications should only come from your server. You take time to develop your applications to handle input data in a very specific way whether by checking input on the client side or on the server side, but where is all the input coming from? By calling and splitting the http_referer server variable by / and the http_host server variable you can compare the host of the previous page to your host. The following example will redirect all activity without a referring page to http://my.yahoo.com. All referring pages that have a host other than codeave.com or www.codeave.com will be sent to http://www.yahoo.com. Because the demonstration is opened from a link from CodeAve.com it will display a message stating the referring page was a valid one.
View the Output
Text View
Print View
Mail this Link
Download the Code

<% 
dim u_file,g_file

' Get the address of the referring page
u_file = request.servervariables("http_referer") 

' If there is no referring page then redirect to My.Yahoo.com
if u_file = "" then
response.redirect "http://my.yahoo.com"
response.end
end if

' If there is a referring page then check where it cam from

' Split the referring url by /
' a typical address will split like this
' g_file(0)=http:
' g_file(1)=
' g_file(2)=www.codeave.com or codeave.com
' g_file(3)=Any further subdirectories off the root directory in the request
g_file=split(u_file,"/")

' Compare the host name to the host of the referring page
if (trim(g_file(2) <> request.servervariables("http_host"))) then
response.write g_file(2)
response.redirect "http://www.yahoo.com"
response.end
else %>

<html>
<title>CodeAve.com (Referring Page Source)</title>
<body bgcolor="#FFFFFF">
Vaid Request from server
</body>
</html>
<% end if %>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3