我的做法的:
public partial class System_Logout : AdminPageHelper
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
#region 写入日志...
#endregion
//清空管理员登陆信息
...
//退出并刷新父窗口
JscriptOperator.RefreshParent(Page, "Login.aspx");
}
}
}
// 刷新父窗口
public static void RefreshParent(System.Web.UI.Page page, string url)
{
string strKey;
int i;
string js = @"";
//注册脚本块的Key
strKey = System.DateTime.Now.ToString();
//循环,直至找到某个没被注册过的Key
for (i = 0; i < 10000; i++)
if (!page.ClientScript.IsClientScriptBlockRegistered(strKey + i.ToString()))
break;
page.ClientScript.RegisterClientScriptBlock(page.GetType(), Guid.NewGuid().ToString(), js);
}