string id = Request.QueryString["id"];
        if (id == "000")
        {
            this.btnCancel.PostBackUrl = "javascript:history.go(-1);";
        }
        else 
        {
            categoryListBind();
        }从上一个页面得到参数 如果ID为“000” 则回退到上一个页面。
但是现在这样做了不行。这样写的话。点击连接,页面还是在本页面,再点击第二次,就说网页已过期、、、
谁知道原因帮忙说一下!!!!!!!!!!!!!!!!!!!!!!111

解决方案 »

  1.   

    谁帮忙说一下???????nobody???
      

  2.   

    history.go(1) 不是 -1   不过有时候会出问题
      

  3.   

    能够倒退回原来的页面,肯定会bug一大堆。
      

  4.   

            /// <summary>
            /// 取得上一个页面的host
            /// </summary>
            /// <returns></returns>
            public static string GetHostReferrer()
            {
                string retVal = null;
                try
                {
                    retVal = HttpContext.Current.Request.UrlReferrer.Host;
                }
                catch { }
                if (retVal == null)
                    return "";
                return retVal;
            }
      

  5.   

    那样只是赋值啊,怎么可以执行呢?
    直接是:
    Response.Write("<script>alert('走回去吧!');history.go(-1);</script>");
      

  6.   


    发错了        public static string GetUrlReferrer()
            {
                string retVal = null;
                try
                {
                    retVal = HttpContext.Current.Request.UrlReferrer.ToString();
                }
                catch { } 
                return retVal;
            }
      

  7.   

    如果页面有回发过的话,用history.go(-1)或者history.back()都有问题的,如果要比较正确的话,只能获取上次访问的页面,保存记来,然后再跳转
      

  8.   


      ScriptManager.RegisterStartupScript(this, this.GetType(), "q107770540", "window.history.back(-1);", true);
      

  9.   

    楼上的意思是通过保存上一次反问的URL,然后点击的时候获取返回!
      

  10.   

     #region 返回上一个页面
         /// <summary>
         /// 返回上一个页面
         /// </summary>
        public static  void gobackLast()
        {
            string strbackJs = "<script>history.go(-2);</script>";
            System.Web.HttpContext.Current.Response.Write(strbackJs); 
        }
        #endregion我在页面里是这样用的
      

  11.   

    history.go(-1); 
         返回没有了就过期了
      

  12.   

    this.btnCancel.Attartents.Add("<script>javascript:history.go(-1);</script>");
      

  13.   

    取到返回地址后用js的this.location.href='返回的地址'
      

  14.   

    隐藏控件保存上一页地址,下一页取出控件Value,执行页面跳转。
      

  15.   

     Response.Write("<script>history.go(-2)</script>");
    或者
    history.back()
      

  16.   

    lz就好好看看csdn怎么实现的,在下载的时候没有登录,登录怎么跳回到前一页。仔细看看IE