I have the following jQuery post to an ASP.NET webmethod:
$.ajax({
type: "POST",
url: "AjaxWebMethods.aspx/UpdNote",
contentType: "application/json; charset=utf-8",
data: "{'ID' : '" + id + "', 'note' : '" + note + "' }",
dataType: "json",
success: UpdNote_Success,
error: AjaxError
});
And the web method is declared:
[System.Web.Services.WebMethod(enableSession: true)]
public static int UpdNote(int ID, string note) {
// business logic that eventually returns a number, but simplifying
// ... for the sake of brevity
int retNum = 99;
return retNum;
}
The jQuery post and the web method both work wonderful in a Windows Authenticated environment (ie - users are authenticated by LDAP). However, I recently had to move the website to a server that uses RSA (two-factor authentication, pin and token code) for authenticating users in order to gain access to the site. And what I'm seeing now is that all my jQuery posts are returning "405 error".
Cross-site requests comes to mind, obviously, but none of that is going on here. All of the jQuery AJAX posts are using web methods that are declared in the AjaxWebMethods.aspx, which page resides in the site's own domain.
Thanks in advance for any help or suggestions!
EDIT:
Using Fiddler in IE8 gives me a little more information. The error code that it returns is still 405, but the server error is more descriptive. The server error is "The HTTP verb POST used to access path '/AjaxWebMethods.aspx/UpdNote' is not allowed."
I did try changing the type parameter of the ajax request to GET, but I get a 404 instead (The resource cannot be found).
Also, forgot to mention that this is over SSL (although I don't expect this would make a difference).
EDIT:
After extensive testing (and extensive help from the astute members of stackoverflow) I've determined that 405 error is directly related to the Application Pool that the website is using, and more specifically to the Managed Pipeline Mode that is selected for the Application Pool.
If I use an Application Pool that targets v4.0 (.NET Framework) and Integrated (Managed Pipeline Mode) then my AJAX post works just fine. But if I use an Application Pool that targets v4.0 and Classic (Managed Pipeline Mode) then I get the 405 error.
So at this point I'm still looking for a solution to this question, although I've been able to home-in on the problem.