Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda