首页 新闻 会员 周边

退去框架到登录页面?????????

0
悬赏园豆:10 [已解决问题] 解决于 2011-12-01 11:04

<td style="height: 18px" >
  欢迎 <asp:LoginName ID="LoginName2" runat="server" />的到来!
  [<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Refresh" /> ]
  </td>[code=C#][/code]以上正常,在注销时候,可以退出框架集,显示登陆页

在配置文件中添加以下代码后,就在左侧的内容页中显示了
<location path="admin">
  <system.web>
  <authorization>
  <allow roles="admin"/>
  <deny users="*"/>
  </authorization>
  </system.web>
  </location>
  <location path="user">
  <system.web>
  <authorization>
  <allow roles="user"/>
  <deny users="*"/>
  </authorization>
  </system.web>
  </location>

我如何可正确的退出框架集呢,登陆页可正常以单独形式显示呢??

悟行的主页 悟行 | 专家六级 | 园豆:12559
提问于:2011-11-30 16:40
< >
分享
最佳答案
0

用js的

window.top.location.href="登录页地址"

可以跳出所有的框架

收获园豆:10
artwl | 专家六级 |园豆:16736 | 2011-11-30 18:04

/// <summary>
    /// 验证是否已经登陆系统
    /// </summary>
    /// <param name="p"></param>
    /// <returns></returns>
    public static bool isLogin(Page p)
    {
        HttpSessionState mysession = HttpContext.Current.Session;
        if (mysession["Login"] == null)
        {

            string LoginPage = p.Request.Url.Scheme + "://" + p.Request.Url.Authority + p.Request.ApplicationPath + "/login.aspx";
            p.Response.Write("<script language='javascript' type='text/javascript'>window.onload=function(){window.top.location.href = " + LoginPage + ";}</script>");
            //p.RegisterStartupScript("msgHideFunction", "<script language='javascript' type='text/javascript'>window.top.location.href = " + LoginPage + ";</script>");

            return false;
        }
        return true;
    }

 if (!IsPostBack)
        {
            if (!Logins.isLogin(this))
            {
                //进入首页。
                return;
            }

}

我这样试了的,但是还是不行,请明示,不胜感激。

悟行 | 园豆:12559 (专家六级) | 2011-11-30 20:18

@PursueZhang: 你这样写了后是什么状况,js执行了吗?

artwl | 园豆:16736 (专家六级) | 2011-11-30 21:05

@artwl: 非常感谢你的指点,你的那个能解决我问题,相当的感谢。

悟行 | 园豆:12559 (专家六级) | 2011-12-01 11:04
其他回答(1)
0

用这个试试  Response.Redirect("<script>window.parent.location.href=' ../logon.aspx';</script>");

wvsy | 园豆:297 (菜鸟二级) | 2011-12-01 11:06
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册