Reputation: 25
I need to test 405 error page, but I have no idea how to create the 405 error.
Is there a way to reproduce 405 error on my site?
Upvotes: 1
Views: 2015
Reputation: 2048
HTTP response status code 405
means Method Not Allowed
. This status code states that HTTP method was received and recognized by the server, but the server has rejected that particular method for the requested resource.
The easiest way to stimulate the response code 405
is to either
Try the following example with an HTTP tool like Postman
The following HTTP request tries to use PUT
method on /api/values/
without the right permission
PUT /api/values/1 HTTP/1.1
Content-type: application/json
Host: localhost
Accept: */*
Content-Length: 12
"Some Value"
HTTP Response states code 405
HTTP/1.1 405 Method Not Allowed
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.0
X-Powered-By: ASP.NET
Date: Wed, 15 May 2013 02:38:57 GMT
Content-Length: 72
{"Message":"The requested resource does not support http method 'PUT'."}
Upvotes: 2