现在的位置: 首页 > 综合 > 正文

页面返回

2012年12月14日 ⁄ 综合 ⁄ 共 707字 ⁄ 字号 评论关闭

 

  /// <summary>
        /// 获得上一页面的URL
        /// </summary>
        public string EnterURL
        {
            get
            {
                object oEnterURL = this.ViewState["oEnterURL"];

                return oEnterURL == null ? string.Empty : (string)oEnterURL;
            }
            set
            {
                this.ViewState["oEnterURL"] = value;
            }
        }

 

 

 

页面加载:

  if (!IsPostBack)
            {
                this.EnterURL = this.Request.UrlReferrer.PathAndQuery;
            }

 

 

返回:

 /// <summary>
        /// 返回
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnReturn_Click(object sender, System.EventArgs e)
        {
            Response.Redirect(EnterURL);
        }

抱歉!评论已关闭.