I use HTTP PUT
and DELETE
in my ASP.NET MVC3 application. When I run it in local, every thing works correctly; But when I publish the application to the server, these methods do not work.
Are there any special settings for enable a web server to support PUT
and DELETE
requests? I'm using shared hosting with IIS 7.5.
I enable PUT
and DELETE
requests in IIS manager
. PUT
command work fine. But DELETE
still not works. I create requests by jQuery
:
I'm in this page:
http://example.com/dashboard/edit-site/103323/links/
and my AJAX call is:
$.ajax({
// url: same as page-url,
cache: false,
type: 'DELETE',
data: { linkid: $(link).data("linkid") },
beforeSend: function () {
// doing something in UI
},
complete: function () {
// doing something in UI
},
success: function (data) {
// doing something in UI
},
error: function () {
// doing something in UI
}
});
This will create a request like this:
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://example.com
Referer: http://example.com/dashboard/edit-site/103323/links/
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
X-Requested-With: XMLHttpRequest
With this Form Data
:
linkid:104044