//首先要获取URL如下所示
private string UrlReferrer
{
set
{
ViewState[UrlReferrer] = value;
}
get
{
if (ViewState[UrlReferrer] != null)
{
return ViewState[UrlReferrer]ToString();
}
else
{
return ;
}
}
}
//然后在Page_Load里面添加代码必需要在IsPostBack里面 否则地址会被覆盖为当前页
protected void Page_Load(object sender EventArgs e)
{
if (!IsPostBack)
{
if (thisPageRequestUrlReferrer != null)
{
UrlReferrer = thisPageRequestUrlReferrerToString();
}
}
}
//最后在返回方法中直接跳转地址 ResponseRedirect(UrlReferrer) ; 即可