最近在用iframe做东西,想要实现当登录过时自动跳转到登录页面,但是老是把登录页面在<iframe>子页面显示,为此查了多方资料,后来经高手指导这样解决了:
在iframe中调用到的那些子页的Page_Load事件中添加下面代码:
if (Session["UserName"] == null)
{
Response.Write(" <script> top.location.href= 'login.aspx '; </script> ");
}
最近在用iframe做东西,想要实现当登录过时自动跳转到登录页面,但是老是把登录页面在<iframe>子页面显示,为此查了多方资料,后来经高手指导这样解决了:
在iframe中调用到的那些子页的Page_Load事件中添加下面代码:
if (Session["UserName"] == null)
{
Response.Write(" <script> top.location.href= 'login.aspx '; </script> ");
}