如何在Web方法中重定向到另一个页面 [英] How to redirect to another page in web method
本文介绍了如何在Web方法中重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Web方法重定向到另一个页面
我已经使用过,但页面无法重定向.
[WebMethod]
公共 静态 void Go_BDPolicy(字符串 pol)
{
字符串 result = " " ;
HttpContext.Current.Response.Redirect(" ,错误);
}
解决方案
在您的网络方法更改中,例如此 : [WebMethod] 公共 静态 void Go_BDPolicy(字符串 pol) { 返回 " ; } 成功的部分代码更改如下: 成功:功能(结果){ var msg = Result.d; 如果(msg == " ) { window.location.href = " ; } } 我执行了它并且有效:):D
尝试使用
Response.Redirect(" );
How to redirect to another page in web method
i have used but page not redirect.
[WebMethod]
public static void Go_BDPolicy(string pol)
{
string result = "Welcome Mr. " + pol + "";
HttpContext.Current.Response.Redirect("~/DirectCSD/BusinessDeveloper.aspx",false);
}
解决方案
In your webmethod change like this: [WebMethod] public static void Go_BDPolicy(string pol) { return "Any Msg"; } In success part of your code change like: success: function (Result) { var msg = Result.d; if (msg == "Any Msg") { window.location.href = "Page.aspx"; } } I executed and it works :) :D
Try with
Response.Redirect("BusinessDeveloper.aspx");
这篇关于如何在Web方法中重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文