LoginStatus not logging users out?

Have you noticed your LoginStatus control doesn't log the user out when you click Logout? Well, to fix this all you need to do is add an id attribute.

This works

<asp:LoginStatus runat="server" id="loginstatus1" />

This doesn't work

<asp:LoginStatus runat="server" />

Searching the web, there are a lot of people complaining that the LoginStatus doesn't work properly. Solutions are rare, special thanks to Ric Hayman for finding this.

Author Paul Hayman

Paul is the COO of kwiboo ltd and has more than 20 years IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services.

Paul is the COO and co-founder of kwiboo (http://www.kwiboo.com/) and is also the creator of GeekZilla.

Comments

Nolan said:

Thank you for taking the time to put this up.

Saved me a LOT of time!

19/Sep/2007 15:11 PM

Andy Nelms said:

I have a LoginStatus control on asn ASP 3.5 site master page. It has an ID specified. I take all the defaults. It is sitting inside a LoginView as demonstrated below. Logout fails. No exceptions are thrown. Any ideas?

<div id="TopLoginBox"><br />

  <asp:LoginName ID="LoginName1" runat="server" Csslass="TopLoginName"  FormatString="You are logged in as {0} " /><br /><br />

    <div id="TopLoginView">

      <asp:LoginView ID="LoginView1" runat="server" >

        <RoleGroups>

          <asp:RoleGroup Roles="Manager">

            <ContentTemplate>  

              <div id="TopLoginStatusBox">

                 <asp:HyperLink ID="HyperLink1" runat="server" 

                                                                    NavigateUrl="/Administration/Default.aspx">Manage Site</asp:HyperLink> or                                      

                   <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutText="Logout" />

                </div>

             <ContentTemplate>                                     

         </asp:RoleGroup>                                                               

                                 </RoleGroups>                               

                               <AnonymousTemplate>                            

      <asp:LoginStatus ID="TopLoginStatus" CssClass="TopLoginStatus" runat="server" LoginText="Login" />

                               </AnonymousTemplate>                           

              </asp:LoginView> 

          </div>                           

       </div>

31/May/2008 14:21 PM

Add Comment

Name
Comment
 

Your comment has been received and will be shown once it passes moderation.