c# ascx控件中 js 登錄後跳轉到之前的頁面

情況: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>");
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章