LoginStatus problem

Last post 05-16-2008 7:02 PM by EdSF. 3 replies.

Sort Posts:

  • LoginStatus problem

    07-13-2007, 5:50 AM
    • Loading...
    • enghsiang
    • Joined on 06-14-2007, 5:03 AM
    • Malaysia
    • Posts 202

    when click the logout at the LoginStatus,my session is not abandon.

    any idea how to abandon session or set session to null after clicking the logout at the LoginStatus???

    or anyone can teach me how to redirect to my own created logout page after the Logout in the LoginStatus is click

    C#######################################
  • Re: LoginStatus problem

    07-13-2007, 9:53 AM
    Answer
    • Loading...
    • lspence
    • Joined on 11-01-2006, 2:12 PM
    • Posts 753

     Call Session.Abandon().

    My Blog
    http://Lspence.blogspot.com

    (Please MARK this post as ANSWERED, if you find it helpful)
  • Re: LoginStatus problem

    07-13-2007, 2:44 PM
    Answer
    • Loading...
    • mbbc33
    • Joined on 07-11-2007, 7:24 PM
    • Cheyenne, Wyoming, USA
    • Posts 29
    Try this...
                <asp:LoginView ID="LoginView1" runat="server">
                    <LoggedinTemplate>
                        <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect" LogoutPageUrl="[your logout page]" Style="position: relative" />
                    </LoggedinTemplate>                
                </asp:LoginView>
     
    mbbc33
    If this post was helpful to you, please "Mark As Answer"

  • Re: LoginStatus problem

    05-16-2008, 7:02 PM
    • Loading...
    • EdSF
    • Joined on 04-08-2006, 6:32 PM
    • Posts 19

    mbbc33:
    Try this...

                <asp:LoginView ID="LoginView1" runat="server">
                    <LoggedinTemplate>
                        <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="Redirect" LogoutPageUrl="[your logout page]" Style="position: relative" />
                    </LoggedinTemplate>                
                </asp:LoginView>

     

     

     

    Revisiting the above as it only Logs out a user (FormsAuthentication). It does NOT clear your session variables. I have a "dirty" way of dealing with this where the Session.Clear (or Abandon) is run at the page the user is redirected to.

     However, I'd prefer the "cleaner" way of doing so via the LoginStatus.LoggingOut  Event which is easy if the LoginStatus control were on it's own. In the above example, it's within a LoginView Template...which surprisingly can't be referenced???

     To rephrase: How can you capture the LoggingOut Event of the LoginStatus control if/when it is used inside a template (ex. LoginView above)?

     Thanks...
     

    Ed
Page 1 of 1 (4 items)