Forms Authentication, Frames, and the SignOut Method


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Forms Authentication, Frames, and the SignOut Method

  1. #1
    Todd Willoughby Guest

    Forms Authentication, Frames, and the SignOut Method


    I have designed an ASPX web page that contains 3 frames: header, left side
    navbar, and main frame. I am using Forms Authentication with a SQL database
    to store the info. The RedirectFromLoginPage works great when authentication
    is approved. I have a "Sign Out" button on the navbar frame that calls FormsAuthentication.SignOut,
    which kills the authentication cookie and then redirects the user back to
    the login page.

    Here's the problem: I want the entire page to go back to the Login page,
    but only the Navbar frame gets redirected - the other 2 frames stay the same.
    And if I refresh either of the other 2 frames, it then loads its own instance
    of the Login page because the cookie is gone.

    How do I get the entire set of 3 frames to be replaced by the initial login
    page instead of just one frame getting the page instance?

    By the way, if I just hit F5 or hit the Refresh button up on the toolbar
    of the browser, it does reload the entire page into the Login Page. It's
    just in the Click Event of the Sign Out button that the problem occurs.

    Thanks in advance.

  2. #2
    David A. Rothgery Guest

    Re: Forms Authentication, Frames, and the SignOut Method

    Todd Willoughby <aspx@gladiatori.com> wrote:
    >
    > I have designed an ASPX web page that contains 3 frames: header, left side
    > navbar, and main frame. I am using Forms Authentication with a SQL database
    > to store the info. The RedirectFromLoginPage works great when authentication
    > is approved. I have a "Sign Out" button on the navbar frame that calls
    > FormsAuthentication.SignOut,
    > which kills the authentication cookie and then redirects the user back to
    > the login page.
    >
    > Here's the problem: I want the entire page to go back to the Login page,
    > but only the Navbar frame gets redirected - the other 2 frames stay the same.
    > And if I refresh either of the other 2 frames, it then loads its own instance
    > of the Login page because the cookie is gone.
    >
    > How do I get the entire set of 3 frames to be replaced by the initial login
    > page instead of just one frame getting the page instance?


    Either
    1) Drop a bit of client-side JavaScript into the onload event of the
    login page to force it to the top level (you should be able to find code
    for this on the web).
    or
    2) Build a dedicated log out page, and replace the sign out button with
    a simple hyperlink to it (with the target property set to "_top").

    --
    Dave Rothgery
    Picking nits since 1976
    drothgery@alum.wpi.edu
    http://drothgery.editthispage.com

  3. #3
    Greg Rothlander Guest

    Re: Forms Authentication, Frames, and the SignOut Method


    I'm guessing that this is a pretty common problem with framesets. I do not
    use them but I do use IFRAME in a lot of my pages. It has been my experiance
    that most programmers do not like using the framesets. I have found a few
    instances where and frame is a good idea but I use the IFRAME instead.


    The only way I can get the actual browser itself to reload and not the IFRAME,
    or in your case the navbar frame.

    Eventhough you not using Javascript you are probably doing is some that is
    the equivalent of the following JavaScript.

    self.location = "url"

    Try this...

    Window.location = "url"

    If you need to embed it as an HREF or something from within the page... try
    something like...

    <A HREF="javascript:Window.location = 'url.aspx'">
    <img name="btnAdd" src="../Images/buttons/add<%=Session("Access")%>
    .gif" BORDER="0" onMouseOver="this.style.cursor='hand'">
    </A>


    "Todd Willoughby" <aspx@gladiatori.com> wrote:
    >
    >I have designed an ASPX web page that contains 3 frames: header, left side
    >navbar, and main frame. I am using Forms Authentication with a SQL database
    >to store the info. The RedirectFromLoginPage works great when authentication
    >is approved. I have a "Sign Out" button on the navbar frame that calls

    FormsAuthentication.SignOut,
    >which kills the authentication cookie and then redirects the user back to
    >the login page.
    >
    >Here's the problem: I want the entire page to go back to the Login page,
    >but only the Navbar frame gets redirected - the other 2 frames stay the

    same.
    > And if I refresh either of the other 2 frames, it then loads its own instance
    >of the Login page because the cookie is gone.
    >
    >How do I get the entire set of 3 frames to be replaced by the initial login
    >page instead of just one frame getting the page instance?
    >
    >By the way, if I just hit F5 or hit the Refresh button up on the toolbar
    >of the browser, it does reload the entire page into the Login Page. It's
    >just in the Click Event of the Sign Out button that the problem occurs.
    >
    >Thanks in advance.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center