im currently setting up asp.net to accept DELETE http verb in the application. However, when i send
"DELETE /posts/delete/1"
i always get a 405 Method not allow error. I tried to take a look at the header:
Response Headers
Cache-Control private
Pragma No-Cache
Allow GET, HEAD, OPTIONS, TRACE
Content-Type text/html; charset=utf-8
Server Microsoft-IIS/7.5, Private-Server
Date Tue, 17 Nov 2009 18:30:31 GMT
Content-Length 5590
Allow GET, HEAD, OPTIONS, TRACE
notice the Allow header in IIS7, it's only allow GET HEAD OPTIONS and TRACE. I currently using [AcceptVerbs(HttpVerbs.Delete)] in my delete controller (i think this one is extended by MVCContrib, correct me if im wrong)
PS: i send DELETE using Javascript:
function _ajax_request(url, data, callback, type, method) {
if (jQuery.isFunction(data)) {
callback = data;
data = {};
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
}
and:
_ajax_request($(this).attr('href'), "", function(d) { alert("submit"); }, "json", 'DELETE');
THank you in advance!