string id = Request.QueryString["id"];
if (id == "000")
{
this.btnCancel.PostBackUrl = "javascript:history.go(-1);";
}
else
{
categoryListBind();
}从上一个页面得到参数 如果ID为“000” 则回退到上一个页面。
但是现在这样做了不行。这样写的话。点击连接,页面还是在本页面,再点击第二次,就说网页已过期、、、
谁知道原因帮忙说一下!!!!!!!!!!!!!!!!!!!!!!111
if (id == "000")
{
this.btnCancel.PostBackUrl = "javascript:history.go(-1);";
}
else
{
categoryListBind();
}从上一个页面得到参数 如果ID为“000” 则回退到上一个页面。
但是现在这样做了不行。这样写的话。点击连接,页面还是在本页面,再点击第二次,就说网页已过期、、、
谁知道原因帮忙说一下!!!!!!!!!!!!!!!!!!!!!!111
/// 取得上一个页面的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;
}
直接是:
Response.Write("<script>alert('走回去吧!');history.go(-1);</script>");
发错了 public static string GetUrlReferrer()
{
string retVal = null;
try
{
retVal = HttpContext.Current.Request.UrlReferrer.ToString();
}
catch { }
return retVal;
}
ScriptManager.RegisterStartupScript(this, this.GetType(), "q107770540", "window.history.back(-1);", true);
/// <summary>
/// 返回上一个页面
/// </summary>
public static void gobackLast()
{
string strbackJs = "<script>history.go(-2);</script>";
System.Web.HttpContext.Current.Response.Write(strbackJs);
}
#endregion我在页面里是这样用的
返回没有了就过期了
或者
history.back()