情況:index.aspx 中有個iframe(login.aspx),login.aspx頁面有2個ascx控件,在其中一個ascx控件中跳到index.aspx
在ascx.cs中使用了很多種的刷新頁面的方法都失敗了,最後嘗試下面的方法,終於成功了.
1.location.reload()使用後會一直重複刷新頁面
2.window.location.reload(); window.opener.location.reload(); parent.document.location.reload();只能刷新到login.aspx
3.最後偶然發現通過再加一個history.go(-1);window.location.reload;就可以跳到index.aspx
Response.Write("<script> alert('登錄成功!');parent.document.location.reload(); history.go(-1);window.location.reload;</script>");