Reputation: 1
I have this WebMethod that redirects to another page on that server.
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
System.Web.HttpContext.Current.Response.Redirect("PRepConsulta.aspx", false);
}
But i get this error:
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'realizaConsulta' failed with the following error: System.InvalidOperationException-- Authentication failed.
What causes this error?
look the other options i have tried:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
System.Web.HttpContext.Current.Server.Execute("PRepConsulta.aspx", false);
}
IT WORKS, BECAUSE, IT GOES TO PRepConsulta.aspx AND EXECUTE THE UNDERCODE, BUT THE PAGE NEVER SHOWS UP.
I HAVE ALSO TRIED:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
HttpContext.Current.Server.Transfer("PRepConsulta.aspx", false);
}
BUT I GOT THIS ERROR:
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'realizaConsulta' failed with the following error: System.Threading.ThreadAbortException-- Subproceso anulado.
I DONT KNOW WHAT ELSE TO TRY
THANKS FOR ANY HELP
Upvotes: 0
Views: 4500
Reputation: 219057
I'm not sure about the "authentication failed" part, but a Response.Redirect inside of a WebMethod is probably going to break the SOAP client that's calling the method. It's expecting a Boolean, not a redirect.
Upvotes: 1
Reputation: 1
ok, im gonna organize the application's flow:
from my client, in javascript, im calling a web service
PageMethods.realizaConsulta(Datos);in my codebehind i have to execute the pageMethod and call another page
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
clsGeneral consulta;
DataTable dtTemp = new DataTable();
using (consulta = new clsGeneral("SQLConn"))
{
consulta.consultaPrograma(ref dtTemp, datos["Codigo"], Int16.Parse(datos["Cod_Actividad"]), Int16.Parse(datos["Cod_SubActividad"]), datos["FechaIni"], datos["FechaFin"]);
HttpContext.Current.Session["Consulta"] = dtTemp;
//THIS ARE THE 3 DIFFERENT WAYS I HAVE TRIED TO CALL THE PRepConsulta.aspx,
//I DONT KNOW IF THERE IS A BETTHER WAY TO DO IT
//System.Web.HttpContext.Current.Response.Redirect("PRepConsulta.aspx", false);
//HttpContext.Current.Server.Transfer("PRepConsulta.aspx", false);
//System.Web.HttpContext.Current.Server.Execute("PRepConsulta.aspx",writer, false);
}
return true;
}
THANKS
Upvotes: 0