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");
}
}