我有這個WebMethod重定向到該服務器上的另一個頁面。重定向從服務器的新頁面
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
System.Web.HttpContext.Current.Response.Redirect("PRepConsulta.aspx", false);
}
,但我得到這個錯誤:
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'realizaConsulta' failed with the following error: System.InvalidOperationException-- Authentication failed.
是什麼原因導致這個錯誤?
看我已經嘗試了其他選項:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
System.Web.HttpContext.Current.Server.Execute("PRepConsulta.aspx", false);
}
它的作品,因爲它關係到PRepConsulta.aspx並執行UNDERCODE,但頁面一直沒有出現。
我也曾嘗試:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public static Boolean realizaConsulta(Dictionary<string, string> datos)
{
HttpContext.Current.Server.Transfer("PRepConsulta.aspx", false);
}
,但我得到這個錯誤:
微軟JScript運行時錯誤:Sys.Net.WebServiceFailedException:服務器方法 'realizaConsulta' 失敗,出現以下錯誤:系統.Threading.ThreadAbortException - 子進程anulado。
我不知道還有什麼嘗試
感謝所有幫助
什麼是你調用的WebMethod目標是什麼?您是否想顯示其他內容或根據您傳遞的數據將用戶發送到適當的頁面? 你可能更好的是將查詢字符串中的數據傳遞到新頁面並從那裏重定向。 – 2010-06-28 16:51:58