Search code examples
asp.netiisiis-7asp-classic

Getting Referer from Custom 404 page


The custom 404 error only gives you the page that was not found when using Request.Servervariables("QUERY_STRING") , Well aware of this.

But how do you get the referer of that page?

Request.Servervariables("HTTP_REFERER") in the custom 404 error page, does NOT return the referring page of the page which calls the 404 page.

The pages are in this order:

  1. Referring Page to Invalid URL (/home/)
  2. Invalid URL (/invalidurl)
  3. 404 Error Page (/404)

I'm trying to get the Referring page (1) from the 404 Error Page (3), not the Invalid URL (2) as you do by using the Request.Servervariables("QUERY_STRING")

Any suggestions?


Solution

  • The simple answer to this is: no.