Generate a 404 error RRS feed

  • Question

  • User1254222884 posted

    How do I generate an http 404 response error from my httpModule?

    For example, I have a one-page site and there are some old QueryString values floating around on search-engine sites that are no longer valid (those sections of the site are no longer available).  So, I want to capture the fact that a request is attempting to go to that section and return a 404.

    I've tried:

    Response.StatusCode = 404

    But that sends a 200 response code to the browser/crawler.

    I've done the "redirect to a nonexistant page", but it sends a 302 followed by another 302 AND THEN a 404.

    Anyone know how I can get asp.net to just return a 404 to the requester?


    Wednesday, July 3, 2013 5:33 PM

All replies