Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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");
}

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
============================================================
ASP.NET
<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>
Posted
Updated 29-Dec-16 22:58pm
v8

I got the answer
window.parent.location.href = 'Login.aspx'
is making me to achieve it.. But is this the right way to achieve it?

HTML
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>");            
        }
 
Share this answer
 
You have to set the cookieSameSite= "None" in the session state tag to avoid this issue. I have tried this and working well.

<sessionState cookieSameSite="None"  cookieless="false" timeout="360">
</sessionState>


Please check the given below URL:

Problem with Session in iFrame after recent windows update | The ASP.NET Forums[^]


https://support.microsoft.com/en-us/help/4524420/kb4524420[^]
 
Share this answer
 
v3
Comments
OriginalGriff 26-Dec-19 6:25am    
While I applaud your urge to help people, it's a good idea to stick to new questions, rather than 3 year old ones. After that amount of time, it's unlikely that the original poster is at all interested in the problem any more - particularly since he gave his solution within the hour...
Answering old questions can be seen as rep-point hunting, which is a form of site abuse. The more trigger happy amongst us will start the process of banning you from the site if you aren't careful. Stick to new questions and you'll be fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900