Results 1 to 2 of 2

Thread: Request.ServerVariables("HTTP_REFERER")

  1. #1
    Join Date
    Dec 1969

    Default Request.ServerVariables("HTTP_REFERER")

    Hi<BR><BR>I&#039;m using Request.ServerVariables("HTTP_REFERER") on a custom404 page to get the page the broken link was help narrow down the search on pages with many links I would like to be able to get the address of the link they were trying to reach?<BR><BR>any ideas.<BR>cheers Matt

  2. #2
    Join Date
    Dec 1969

    Default Have you tried looking at...

    ...the various custom error pages the MS provides for the standard errors?<BR><BR>I would think that one of them would help you get what is needed.<BR><BR>For example, this function (in client side JS) seems to point to what you will be getting for the URL:<BR><BR>function Homepage(){<BR>&#060;!--<BR>// in real bits, urls get returned to our script like this:<BR>// res://shdocvw.dll/http_404.htm# <BR><BR> //For testing use DocURL = "res://shdocvw.dll/http_404.htm#"<BR> DocURL=document.URL;<BR> <BR> //this is where the http or https will be, as found by searching for :// but skipping the res://<BR> protocolIndex=DocURL.indexOf("://",4);<BR> <BR> //this finds the ending slash for the domain server <BR> serverIndex=DocURL.indexOf("/",protocolIndex + 3);<BR><BR> //for the href, we need a valid URL to the domain. We search for the # symbol to find the begining <BR> //of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.<BR> //urlresult=DocURL.substring(protocolIndex - 4,serverIndex);<BR> BeginURL=DocURL.indexOf("#",1) + 1;<BR> urlresult=DocURL.substring(BeginURL,serverIndex);< BR> <BR> //for display, we need to skip after http://, and go to the next slash<BR> displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);<BR> InsertElementAnchor(urlresult, displayresult);<BR>}<BR><BR>So presumably you could process Request.ServerVariables("URL") in the same way???<BR><BR>NEver tried it; just a guess.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts