功能描述:当点击页面A的“详细信息”时,跳转到页面C,点击页面C的“返回”按钮时返回到页面A ;当点击页面B的“查看”时,跳转到页面C,点击页面C的“返回”按钮时返回到页面B

代码:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)//记录上一个页面地址
            {
                string strUrl = Request.UrlReferrer.AbsolutePath;
                ViewState["Url"] = strUrl;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)//返回
        {
            string strUrl = ViewState["Url"].ToString();
            Response.Redirect(strUrl);
        }

 

转自:http://www.cnblogs.com/joy-126/archive/2012/04/06/2434794.html

 posted on 2012-04-11 09:22  纳米程序员  阅读(167)  评论(0编辑  收藏  举报