ASP.NET中的iframes注销问题(仅在iframe中发生登录页面重定向) [英] Iframes logout issue in ASP.NET (login page redirection happening only in the iframe)

查看:79
本文介绍了ASP.NET中的iframes注销问题(仅在iframe中发生登录页面重定向)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在母版页中使用3个iframe。



iframe-1引用TopMenu.aspx

iframe-2引用到WelcomePage .aspx

iframe-3引用BottomMenu.aspx





我已经放置了Logout按钮(即在TopMenu.aspx中的ImgbtnLogOut)引用iframe-1



onclcick的注销按钮,我试图杀死会话,然后尝试重定向到login.aspx页面。



这里的问题就像我在TopMenu.aspx中放置了Logout Button一样,重定向仅在Iframe-1中发生但不考虑整个屏幕。我可以知道我怎么能解决这样的问题..?



我尝试了什么:



Im using 3 Iframes in the master page.

iframe-1 referenced to TopMenu.aspx
iframe-2 referenced to WelcomePage.aspx
iframe-3 referenced to BottomMenu.aspx


I had placed the Logout button (i.e ImgbtnLogOut) in TopMenu.aspx which is referenced to iframe-1

onclcick of logout button, i'm trying to kill the session and and then trying to redirect to the login.aspx page.

issue here is as i had placed the Logout Button in TopMenu.aspx, the redirection happening only in Iframe-1 but not considering the entire screen. May i know that how can i resolve such a probe..?

What I have tried:

protected void ImgbtnLogOut_Click(object sender, ImageClickEventArgs e)
{
      Session.RemoveAll();
      Session.Abandon();
      FormsAuthentication.SignOut();
      FormsAuthentication.RedirectToLoginPage();
      //Response.Redirect("~/Login.aspx");
}



我正在使用表单身份验证

================ ===========================================

WEB.Config

====================================== =====================




I'm Using Forms Authentication
===========================================================
WEB.Config
===========================================================

<authentication mode="Forms">
      <forms loginUrl="Login.aspx"  enableCrossAppRedirects="false">
      </forms>
</authentication>



========================== ==================================

这是主页源代码

=========================================== =================


============================================================
Here is the master page Source Code
============================================================

<body class="size-960">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
 <div style="text-align: center">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div id="topframe">
                  <input id="UserPassword" runat="server" type="hidden" />
                    <iframe height="175px" width="1000px" scrolling="no" id="TopFrame" name="TopFrame"

                        frameborder="0" src="TopMenu.aspx"> <%--85px--%>
                    </iframe>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <center>
                     <iframe height="480px" width="1000px"   id="MainFrame" name="MainFrame"

                             frameborder="0" src="AccountDetails.aspx"> <%--580px--%>
                        </iframe>
                    </center>
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:ContentPlaceHolder>
       <asp:UpdatePanel ID="UpdatePanel3" runat="server">
            <ContentTemplate>
                <center>
                    <iframe height="30px" width="1000px" scrolling="no" id="BottomFrame" name="BottomFrame"

                       frameborder="0" src="BottomMenu.aspx"> 
                    </iframe>
                </center>
            </ContentTemplate>
        </asp:UpdatePanel><%--85px--%>
        <div id="warning" style="display: none">
         
        </div>
    </div>
    </form>
</body>

推荐答案

我得到了答案
window.parent.location.href = 'Login.aspx'

让我实现它..但这是实现它的正确方法吗?



is making me to achieve it.. But is this the right way to achieve it?

protected void ImgbtnLogOut_Click(object sender, ImageClickEventArgs e)
        {
            Session.RemoveAll();
            Session.Abandon();
            FormsAuthentication.SignOut();
            //FormsAuthentication.RedirectToLoginPage();
            ClientScript.RegisterStartupScript(GetType(), "Load", "<script type='text/javascript'>window.parent.location.href = 'Login.aspx'; </script>");            
        }


这篇关于ASP.NET中的iframes注销问题(仅在iframe中发生登录页面重定向)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆