views:

68

answers:

2

Hi,

For testing purposes it would be nice to have a site that has links that align with the various HTTP error codes (or at least the main ones), that is they will produce the associated error page. For example a link that will produce a 501 etc. (I am NOT looking for a list of HTTP error codes)

Is there a sites with pages/sites that give the various error codes?

thanks

+2  A: 

You can to combine List of HTTP status codes with this C# code:

int code = 404;
int text = "Not found";
throw new HttpException(code, text);
Rubens Farias
I was after an existing site if one existing Rubens that had already links to produce the errors (take your point however)
Greg
Whilst didn't answer my specific question this was the best work around answer
Greg
+1  A: 

No one comes to mind. But you can just create one yourself.

Kickoff example with Java Servlet:

public class ErrorServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException ){
        response.sendError(Integer.parseInt(request.getParameter("sc")));
    }
}

Map it on an url-pattern of /error and test it as http://example.com/error?sc=500.By the way, omitting the status code or entering a non-numeric value will produce 500 anyway ;)

Or in JSP flavor:

<% response.sendError(Integer.parseInt(request.getParameter("sc"))); %>

Or if you like PHP more:

<?php header('HTTP/1.1 ' . $_GET['sc']); ?>
BalusC
ummm, am I supposed to up vote if the question wasn't answered but provided some good advice generally associated with the question? :)
Greg
It's your choice. If you find it **useful**, upvote it. If blatantly offensive or intentionally wrong or complete nonsense, downvote it. If neither, leave it as is. I would just show that it costs less time creating one yourself than time spent searching for an existing one or posting a question and waiting for answers at SO ;)
BalusC