Forum Moderators: open

Message Too Old, No Replies

IIS returns 200 status for files that don't exist. How do I fix it?

         

rreigan

3:39 pm on Jul 19, 2007 (gmt 0)

10+ Year Member



Hi all,
With a developer position, I inherited a web server (IIS 6.0), that I should administer. Going throug a web log I noticed GET,POST,PUT entries for non-existing files and for some reason server responds with 200 (OK) status code, when it should be 404.

How do I fix it, so IIS returns proper code? I went through site properties bout found nothing I could tweak.

Here's an example where I don't have a robots.txt on server.

2007-07-17 15:03:30 W3SVC1 xx.x.xx.xx GET /robots.txt - 80 - 65.55.215.51 msnbot/1.0+(+http://search.msn.com/msnbot.htm) - - 200 0 0 382 159 15

Receptional Andy

1:57 pm on Jul 20, 2007 (gmt 0)



Is a custom error page defined? If so this may be causing the problem. If you use a 'URL' as a custom error on some IIS installs it will always deliver a 200 status code. Never quite got to the bottom of that one, but using a 'file' solves the problem.

[edited by: Receptional_Andy at 1:57 pm (utc) on July 20, 2007]

rreigan

2:57 pm on Jul 20, 2007 (gmt 0)

10+ Year Member



Thanks Andy.
Problem is that my 404 page is not static html page. It's an ASP page that extracts referer, current path and processes user submitted notification.
So, if I change to a file, ASP stops working.

LifeinAsia

3:24 pm on Jul 20, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It stops working if you return it to the default setting for 404? THat definitely sounds strange...

Receptional Andy

11:00 am on Jul 21, 2007 (gmt 0)



Problem is that my 404 page is not static html page. It's an ASP page

Simple fix then - explicitly set a 404 header within your ASP page:

Response.Status = "404 Not Found"

rreigan

8:13 pm on Jul 23, 2007 (gmt 0)

10+ Year Member



Andy,
That seems to be working. Thanks so much.

Steve