0

I have a simple 404 error page using asp classic that emails me when a user encounters a 404 error. I use Request.ServerVariables("Query_String") to send the url. I would like to improve this so that I know what page contains the link to the missing file or resource. Using Request.ServerVariables("Query_String") I only know that the requested url has not been found, but if there is a page with a bad link I would like to know that age's url as well so I can fix it. This would also help for pages that have missing images or other resources. Thanks for any help.

I should have said this was an Intranet. I can look through logs but getting an email sure is easier. I recently did a major cleanup, this site is 10 years old and had a lot of baggage. Occasionally I get an email that an htc, css or image was not found but I wasn't seeing the page that contained the link to the missing resource, just that the file was not found. Additionally, if there is a link to a page that has been removed, I want to know what page has that link.

user1633947
  • 149
  • 2
  • 12
  • what do you mean by "page with bad link". Do you mean mismatched link? – polin Dec 01 '12 at 08:58
  • You can't really know that. You can try to use `Request.ServerVariables("HTTP_REFERER")` but it's not very reliable and will usually be empty. – Shadow The GPT Wizard Dec 02 '12 at 08:09
  • Request.ServerVariables("HTTP_REFERER") so far is telling me what I want to know. I think if this is blank that the user may have a bookmark to a file that file that has been removed. Thanks for info, any other insight? – user1633947 Dec 06 '12 at 15:39

1 Answers1

0

There are a couple possibilities. One it could be an external link indexed on google, I would check the 404 pages that google is finding when spidering. You can do this by using the google webmaster tools.

Another options is to use the referrer attribute in the Request that should give you the page that is sending the request

A final option could be to look in the IIS logs both should have the referrer. This option will be more difficult to get the information your looking for without a third party tool to parse the logs.

Referrer in Request

Community
  • 1
  • 1
Robert
  • 3,074
  • 3
  • 24
  • 32