You are not Logged in
Would you like to Login or Register

Today is: Wednesday, 03 December, 2008
Check this months hot topics

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.

kick it on DotNetKicks.com del.icio.us digg Mister Wong YahooMyWeb Reddit Furl Spurl blogmarks
Paul Hayman Skype
Author : Paul Hayman
Published : Monday, 18 June, 2007

Paul is the COO of kwiboo ltd consultant and has more than a decade of 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!

September 19, 2007 - 3: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>

May 31, 2008 - 2:21 PM

Add Comment

Enter your comment below and it will be submitted for moderation.

Your Name

Add Tag

Please enter tags for this article, seperated by semi-colon ;

View Tag's by : # articles | # views