最近在用iframe做东西,想要实现当登录过时自动跳转到登录页面,但是老是把登录页面在<iframe>子页面显示,为此查了多方资料,后来经高手指导这样解决了:

在iframe中调用到的那些子页的Page_Load事件中添加下面代码:

if (Session["UserName"] == null)

        {

            Response.Write(" <script> top.location.href= 'login.aspx '; </script> ");

        }

posted on 2012-07-14 10:31  W.J  阅读(647)  评论(0编辑  收藏  举报