求C#.net代码 怎样跳出 iframe

来源:百度知道 编辑:UC知道 时间:2024/06/01 13:31:10
我的project 用c#写的,用户登陆后,系统检查用户session是否遗失,如果遗失,回到登陆页面。(在用户登陆后,是frame 3个页面,顶,左侧, 和中)

我有些:
Session["objCurStaff"] = null;
Session.Abandon();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);

this.Response.Write("<script>parent.window.navigate('../../login.aspx');</script>");
但不知为什么会不执行
=====================================
| |
| |
| |
======================================
| 1 |
| 1 |
| 1 |
| 1 here is my |
| 1 page |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
=====================================
我要跳出来, 用Response.Redirect("URL"); 不可以,还是跳不出

1.在链接中加入target。_blank - 在一个新的未命名的窗口载入文档_self - 在相同的框架或窗口中载入目标文档_parent - 把文档载入父窗口或包含了超链接引用的框架的框架集_top - 把文档载入包含该超链接的窗口,取代任何当前正在窗口中显示的框架。

2.例程:

Response.Write("<script>window.parent.document.location='../../login.aspx');</script>");

Response.Write("<script>window.parent.document.location='../../login.aspx');</script>");

不要用javascript来跳出框架,
最好就是用Response.Redirect("yourURL");
就可以了

Response.Redirect("../../login.aspx");
这个不能跳???