获取前一页的URL地址

PageLoad:

        if (!IsPostBack)
        {

            ViewState["UrlRef"] = HttpContext.Current.Request.UrlReferrer;
        }

ReturnButton:

 protected void btnReturn_Click(object sender, EventArgs e)
    {
        if (ViewState["UrlRef"] != null)
        {
            Response.Redirect(ViewState["UrlRef"].ToString());
        }
        else
        {
            Response.Redirect("~/Index.aspx");
        }

    }

原文地址:https://www.cnblogs.com/gossip/p/2326261.html