Hi, I am getting a some unusual problem with JQuery ajax. I am using IIS to host my web application and I have http handler for which I have enabled only POST verb on it. Using JQuery ajax, I am posting data to this http handler, this is working fine in our development and testing environment and also most of the time on production environment as well. But sometimes we are getting empty post data on to the server. When we look into the csBytes on IISLog we found that it was very less compare to other success post requests. We are using JSON.js to convert the javascript object back to raw json string and latest jquery.1-3.js for posting to server. Anbody know why this is happening?
Not sure but maybe this is causes by a browser-bug? Since you're getting an empty post to the server the jquery post method works properly but it seems like the json-conversion doesn't work in some cases.
You should have a look it the IIS log files for the USER-AGENT that posts these empty values.
Of course it is also possible that somebody is doing a manual POST to your server... looking for vulnerabilities to exploit.
I don't think it is a problem neither with the browser configuration nor with user posting it manually. Becuase for same session http handler recevied some post data successfully with same client IP and user agent. Our users are not so high professionals to do the manual postings. Therefore I don't think there might be some problem with browser configuration.
I ran into this same problem. Using tamperdata I determined my response header was a 404 err. Is your path mapped properly?
Ex: This worked on my local machine for development, but not on the IIS server:
$.post('/Reservation/UpdateHeadCount', {
id: '<%= Html.Encode(Model.reservation_id) %>',
newHeadCount: SelectedVal
});
This works on both:
$.post('<%= VirtualPathUtility.ToAbsolute("~/Reservation/UpdateHeadCount") %>', {
id: '<%= Html.Encode(Model.reservation_id) %>',
newHeadCount: SelectedVal
});