HTTPModule handles Error, logfile shows status code 200? RRS feed

  • Question

  • User1254222884 posted

    I have an HTTPModule that, among other things, captures errors and shows the user a nice error page.

    The problem is that IIS puts a completion/status code of 200 in the log file. This makes it very difficult to troubleshoot the problem. Is there any way I can set the status code back to the original (say, like 404 for a missing file)?


    Thursday, August 17, 2006 1:52 PM

All replies

  • User312496708 posted

    Why do0nt you try the health monitoring api of asp.net 2.0 for logging application level event.

    Here is a post explaining it http://www.vikramlakhotia.com/Post.aspx?postID=11 





    Vikram's Blog

    Saturday, September 9, 2006 11:52 PM
  • User-158764254 posted

    Since you've handled the page request by returning a page, there is no original 404 to revert to.  the 404 actually never occurred because a page was successfully delivered by your application.  from the perspective of IIS, the successful delivery of your error page is a status 200.

    try setting the HttpResponse.StatusCode when you return your error page.

    Sunday, September 10, 2006 8:53 AM