Home All Groups Group Topic Archive Search About

status code 200 logged in log file

Author
26 May 2009 11:19 PM
Raj
Hi

   I have iisstart.htm,error404.htm(custom error page) pages in my web
application for . When a user reuests page and resource is not found on web
server then the web server executes iisstart.htm and not the error404.htm,
bacause of which the status code logged in IIS log file shows as 200 instead
of 404 error code.

  Can you please advise on how to get the error404.htm page logging 404 code
in IIS?

Thanks in advance.

RA

Author
31 May 2009 11:35 AM
David Wang
On May 26, 4:19 pm, Raj <R***@discussions.microsoft.com> wrote:
Show quoteHide quote
> Hi
>
>    I have iisstart.htm,error404.htm(custom error page) pages in my web
> application for . When a user reuests page and resource is not found on web
> server then the web server executes iisstart.htm and not the error404.htm,
> bacause of which the status code logged in IIS log file shows as 200 instead
> of 404 error code.
>
>   Can you please advise on how to get the error404.htm page logging 404 code
> in IIS?
>
> Thanks in advance.
>
> RA


Your custom error page needs to run code to set the status code that
gets logged. For example, using an ASP or ASP.Net URL as custom error
page. If you use static HTM as custom error, then IIS will not process
the HTM and send it as is with the proper status code logged. That's
how the static error pages work by default.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
Author
31 May 2009 5:54 PM
Raj
Thanks...
    i will explain the situation.
   I have CMS 2002 site hosted in IIS 6.0. I am looking at the IIS log files
where the status codes are not logged properly.
   In IIS Virtual directory , in documents tab the pages mentioned are
        default.htm
        default.asp
        index.htm
        iistart.htm

   In Error tab we have mentioned the URL error404.aspx for 404 status code.

   In web.config file the customerror is set as ;
   <customErrors mode="On" defaultRedirect="~/error.aspx" />

  1) Whever a page is not found we get the custom error404.aspx but the IIS
log file shows 200 as status code. I think by implementing your suggestion
i.e. inserting
<% Response.Status ="404 Not Found" %> at the begning of error404.aspx  page
we can get the 404 as status code logged in IIS when when page/resource is
not found. Please correct me if I am wrong?

2) Sometimes we get the IISSTART.HTM being displayed , I am not
understanding why IISSTART.HTM page is displayed (anyway this is not related
to the above step 1). Can you please let me know when and in what scenarios
this page gets executed ?

Recently I got this page being displayed when there was some problem on
database server which our application uses (as database space was full).
When I see the IIS log file it logged 500 as status code.

Thanks in advance.

Ra


Show quoteHide quote
"David Wang" wrote:

> On May 26, 4:19 pm, Raj <R***@discussions.microsoft.com> wrote:
> > Hi
> >
> >    I have iisstart.htm,error404.htm(custom error page) pages in my web
> > application for . When a user reuests page and resource is not found on web
> > server then the web server executes iisstart.htm and not the error404.htm,
> > bacause of which the status code logged in IIS log file shows as 200 instead
> > of 404 error code.
> >
> >   Can you please advise on how to get the error404.htm page logging 404 code
> > in IIS?
> >
> > Thanks in advance.
> >
> > RA
>
>
> Your custom error page needs to run code to set the status code that
> gets logged. For example, using an ASP or ASP.Net URL as custom error
> page. If you use static HTM as custom error, then IIS will not process
> the HTM and send it as is with the proper status code logged. That's
> how the static error pages work by default.
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
Author
31 May 2009 7:35 PM
Raj
Hi David

   Can you please send me some samples of how to code for custom error code
for logging in IIS log files.

Thanks
Ra

Show quoteHide quote
"David Wang" wrote:

> On May 26, 4:19 pm, Raj <R***@discussions.microsoft.com> wrote:
> > Hi
> >
> >    I have iisstart.htm,error404.htm(custom error page) pages in my web
> > application for . When a user reuests page and resource is not found on web
> > server then the web server executes iisstart.htm and not the error404.htm,
> > bacause of which the status code logged in IIS log file shows as 200 instead
> > of 404 error code.
> >
> >   Can you please advise on how to get the error404.htm page logging 404 code
> > in IIS?
> >
> > Thanks in advance.
> >
> > RA
>
>
> Your custom error page needs to run code to set the status code that
> gets logged. For example, using an ASP or ASP.Net URL as custom error
> page. If you use static HTM as custom error, then IIS will not process
> the HTM and send it as is with the proper status code logged. That's
> how the static error pages work by default.
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>