I have a aspx file and I would like to request to WebMethod in same page with Ajax. However I get some error(you can see below) Actually this code worked before change my server.
Server config
This is my Webmethod code in "Page.aspx"
[WebMethod]
public static string deleteOpenedSegment(decimal segmentID)
{
bool success = Helper.DeleteSegment(segmentID);
if (success)
{
return "true";
}
else
{
return "false";
}
}
And this is my Javascript method in Page.aspx
jQuery.ajax({
url: 'Page.aspx/deleteOpenedSegment',
type: "POST",
data: "{'segmentID':" + getSelectedSegment().attr('id') + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert("okey");
}
});
And also this is capture about request from Google Chrome Web Developer Tool
Error Log
The HTTP verb POST used to access path '/............/Page.aspx/deleteOpenedSegment' is not allowed.
System.Web.HttpException The HTTP verb POST used to access path '/......./Page.aspx/deleteOpenedSegment' is not allowed.
System.Web.HttpException (0x80004005): The HTTP verb POST used to access path '/......./Page.aspx/getSegmentHistory' is not allowed.
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)
Thanks in advance for any help or suggestions!
I have solved this problem. Actually I did not consciously but probleb was fixed. I did Windows Updates after problem solved :) Updates shown below might be help another programmers.