当response.redirect无效时,我累了重定向页面 [英] I tired redirect page when response.redirect is not working

查看:213
本文介绍了当response.redirect无效时,我累了重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下



My code as follows

protected void onCommand(object sender, CommandEventArgs e)
        {
        
 if (e.CommandName == "Edit")
                {
                     Response.Redirect("~/ivorycoast/farmerpage.aspx?action=edit&farmercode=" + e.CommandArgument.ToString(), false);
Application.CompleteRequest();
                }


 if (e.CommandName == "Edit")
                {
                    Response.Redirect("~/ivorycoast/farmerpage.aspx?action=edit&farmercode=" + e.CommandArgument.ToString(), false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
                }

     }





我厌倦了两个代码,但它无效。当我点击编辑时它没有重定向到farmerpage.aspx



上面代码中的错误是什么。我累了好几次但是没有用。



我长期面对这个问题。请告诉我如何解决这个问题。



我尝试了什么:





i tired both the code but it is not working. when i click the edit it is not redirecting to farmerpage.aspx

what is the mistake in my above code. i tired for several times but it is not working.

i am facing this issue for long time. please let me know how to fix this issue.

What I have tried:

protected void onCommand(object sender, CommandEventArgs e)
        {
 if (e.CommandName == "Edit")
                {
                     Response.Redirect("~/ivorycoast/farmerpage.aspx?action=edit&farmercode=" + e.CommandArgument.ToString(), false);
Application.CompleteRequest();
                }


 if (e.CommandName == "Edit")
                {
                    Response.Redirect("~/ivorycoast/farmerpage.aspx?action=edit&farmercode=" + e.CommandArgument.ToString(), false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
                }
        }





我厌倦了两个代码,但它无法正常工作。当我点击编辑时它没有重定向到farmerpage.aspx



上面代码中的错误是什么。我累了好几次但是没有用。



我长期面对这个问题。请告诉我如何解决此问题。



i tired both the code but it is not working. when i click the edit it is not redirecting to farmerpage.aspx

what is the mistake in my above code. i tired for several times but it is not working.

i am facing this issue for long time. please let me know how to fix this issue.

推荐答案

You can try with true means 
Response.Redirect("your URL",true) by default its true .
When we added true it means the current page terminated and another page open.
Hope Its help you.


这篇关于当response.redirect无效时,我累了重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆