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