I'm trying to get IIS 8 to pass the URL of a 404 "page not found" to an ASP error handler page.
Suppose someone tries to go to:
www.mywebsite.com/shelf/ or
www.mywebsite.com/book/
but neither of these directories ("shelf" or "book") exist. So they are redirected to:
www.website.com/myErrorPage.asp
That's fine. I have that working OK.
But at myErrorPage.asp I want to run some code like:
<%
Dim objErrorInfo
Set objErrorInfo = Server.GetLastError
myFile = objErrorInfo.File ' <<<<< URL that doesn't exist
myWord = replace(myFile,"http://www.mywebsite.com/","")
myWord = replace("/","")
select case myWord
case "shelf"
response.write "a place to put books"
case "book"
response.write "something to read"
end select
%>
Somehow I need to have the URL of the page that wasn't found (containing "shelf" or "book") passed to myErrorPage.asp. I'd then strip out the word "shelf", "book", etc so that I can do something with that word on myErrorPage.asp.
But objErrorInfo.Line and objErrorInfo.Source are empty.
Any suggestions?