How to send 404 header using asp

Posted on 2007-09-28
Last Modified: 2008-01-09
I am programming a custom 500 error page that I would like to look like a 404 to googlebot in certain cases.  What is the method for manually setting the status sent to the browser to be 404?  I know there is a simple way to do it in PHP, but I have never seen it done in classic ASP.
Question by:nbraasch
    LVL 23

    Accepted Solution

    does this work?

    <% Response.Status = "404 Not Found" %>
    LVL 14

    Expert Comment

    You may even want to club 200 OK with what @basicinstinct has suggested as some websites report a "not found" error by returning a standard web page with a "200 OK" response code; this is called a soft 404

    Response.Status = "200 OK"
    <!--The rest of your script-->
    LVL 1

    Author Comment

    I don't want to send the 200, since googlebot is requesting a *REALLY* messed up URL which I don't want it to ever try to request again - hence me catching it at the server 500 error level.  I will test with 404 and let this question know what the results are.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
    This video teaches users how to migrate an existing Wordpress website to a new domain.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now