Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
Asp.net Server code executes two times and returns failed callback method

Im calling server code (c#) by jQuery ajax method or ajax pagemethods. While calling, server code executes two times and returns failed callback method.

This code is not working in recently hosted new server. In existing servers, this code working without any problem and returning success callback method.

JS Code:

var myVal = 'Test val';
var input = {
    'val1': myVal
};
$.ajax({
    async: true,
    type: 'POST',
    url: 'MyPage.aspx/MyFunction',
    data: JSON.stringify(input),
    dataType: 'json',
    contentType: 'Application/json',
    success: QCErrorResult,
    error: QCErrorFailedMethod
});

OR

JS Code:

PageMethods.MyFunction(myVal, QCErrorResult, QCErrorFailedMethod);

C# Code:

[WebMethod(EnableSession = false)]
public static string MyFunction(string val1)
{
    // My code here
}

Same issue while calling my api by jquery ajax.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In App_Start/RouteConfig comment the line settings.AutoRedirectMode =RedirectMode.Permanent if its there. For multiple times calling, check the post backs of the page.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!