homepage Welcome to WebmasterWorld Guest from 54.226.147.84
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
404 Not Found - error handler
Handling invalid ASP pages - Redirects with a 302 to the error handler
fabfurs

10+ Year Member



 
Msg#: 2399 posted 1:15 am on Jan 13, 2005 (gmt 0)

Trying to understand my fall from grace within the Google results, I've found stuff in my server logs that I don't like and believe to not be at issue with SEs. I like to get some ideas on how to clean it up. I Recently added a 404 error handler to clean up the URLs.

When a browser request a page using the friendly rewritten URLs the error-handler parses the URL then queries the database, finds the data, then sets the status to 200 and writes the page on the fly. If the data is not found the handler sets the status to 404 and writes out a plain 404 Not Found page.

Everything I thought was perfect, I used a <BASE href="http://www.example.com"> so that the images and links would work regardless of the structure built into the friendly URLs, for example www.example.com/typeOfdoc/docID.htm. But it turns out that most search engines don't use the <BASE href> and I don't use absolute URLs, so now the internal links get crawled by SEs against www.example.com/typeOfdoc/. Still this shouldn't be a problem but all my links are ASP pages.

It seams that when IIS 5.0 encounters an unknown ASP page it uses a 302 redirect to the error-handler which then issues a 404.

Here's an example from my log file:
66.249.xx.#*$! - 192.168.19.229 80 GET /articles/SomeFile.asp -0404_Object_Not_Found 302 0 614 190 www.example.com
66.249.xx.#*$! - 192.168.19.229 80 GET /articles/err-handler.asp 404;http:ww.example.com/articles/SomeFile.asp 404 0 0 242 www.example.com

Notice the 404_Object_Not_Found 302 Status in the in the first log entry above. This doesn't happen with an HTM extension, I just get the second log entry.

I can't find anything on this 404_Object_Not_Found status result other than publicly exposed log files of other servers.

Any ideas?

[edited by: Xoc at 1:50 am (utc) on Jan. 13, 2005]
[edit reason] changed to use example.com [/edit]

 

fabfurs

10+ Year Member



 
Msg#: 2399 posted 2:32 pm on Jan 13, 2005 (gmt 0)

I found my solution and I'm not sure of its value to other members but here it is just the same:

By default the ISAPI ASP.DLL will request the ASP script file without checking for its existance. You can modify the default behaviour and force the Web Server to verify the existence of the script file and issue the appropriate warning message if it doesn't exist, as in my case a 404 without adding the "302 Found" and redirect to my error-handler.

Directions to the fix:
Goto the Web site Properties in the IIS MMC.
Select the Home Directory tab and click on Configuration.
Select the APP Mappings tab.
Highlight the .asp application mapping click on edit.
Turn on option - Check that file exist (default: not checked)
Restart Web Site

Use the Header Checker [webmasterworld.com] to test the response on a non-existing asp file.

sesser

10+ Year Member



 
Msg#: 2399 posted 2:18 am on Jan 14, 2005 (gmt 0)

This is good. Thanks for the tip. Was about to abandon the custom 404 idea because of this issue... but that would have excluded about 45K files in a site redesign.

thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved