01/19/2010
411 Length Required in Firefox 3
Posted by
Andre Small
When using AJAX in FF3.0.x you need to be careful if you are doing a post to webservice method or any end-point that does not accept any parameters as you may get a "411 Length Required - HTTP Error 411. The request must be chunked or have a content length." error from the server.
Since you are not sending any parameters to service, a Content-length header of 0 is set in the request. To fix this, add an empty javascript object. In the case of jQuery, it would look something like this (the change is highlighted in bold):
$.ajax({
type:
"POST",
url: "MyService.
asmx/Logout",
contentType:
"application/json; charset=utf-8",
data: {},
success:
function (msg) { //... },
error:
function (e) { //... }
});
This was tested and verified on FF3 and IIS 7.
« Back to Blog Main Page |