Error pages and the server log

antic

Perch
Hi all,

Just wondering if anyone's had any experience doing this. I have set up an error page to handle 404's, which checks the URL and under certain circumstances returns a file or a page to the browser.

Example: www.domain.com/thispath/thatfile.pdf - does not exist, but it matches a set of valid calls, so the 404 script returns the relevant PDF file to the browser. The 404 script is called "catchthis.asp".

However, in the IIS log (and therefore Webalizer/AWStats), instead of seeing hits recorded for "/thispath/thatfile.pdf", all the hits are being recorded for "/catchthis.asp" (with a special 404 querystring that IIS puts on the end).

Soooo the $63999.95 question is, how can I get IIS to record the "real" URL in the log (and in webalizer etc.)? Anyone managed to do this in the past?
 
I have a feeling this is the wonderful psoft iis log module, but I will give it a check tomorrow after some sleep!
 
Thanks Stephen, but it actually occurs like this locally too. It is the native behaviour of IIS, but there is hopefully a way to change it so it records the actual requested URL as normal, not the error script...?
 
hmmmm... just discovered, after some testing, that IIS only writes the log entry after a script has finished running. This is classic ASP by the way.

Now that opens up the possibility of somehow patching in to some property or other to change the information that IIS saves to the log.... might be possible in .NET, I have doubts it can be done in classic asp... so I will continue my search for the Answer.
 
Hi liming

Can you explain the implementation? Remember, I'm not just trying to do a redirect or url-rewrite, I'm trying to alter what IIS writes in the log file.

eg. instead of:
Code:
"GET /404handler.aspx 404;http://localhost/somefile 404 ..."
I want the IIS log entry to look like:
Code:
"GET /somefile 200 ..."

Do you know how to accomplish that with a httpmodule?
 
Back
Top