November Happy Hour will be moved to Thursday December 5th.

How to write user name into file while logging out

Vote:
 

Hi,

As specified above, i want to write the current user name into a file while logging out.

i simply coudn't catch the log out event

i added OnLoggedOut="LoginStatus1_LoggedOut" to catch it but didn't work :(

i couldn't even write anything as if it was not even thrown !

aspx code:

<LoggedInTemplate>
        <EPiServer:Property ID="Property3" PropertyName="SecondaryBody" runat="server" />
        <div id="CurrentUserStatusArea">
            <asp:literal ID="Literal1" runat="server" Text="<%$ Resources: EPiServer, login.currentuser %>" /> <asp:LoginName ID="LoginName1" runat="server" />.
            <asp:LoginStatus ID="LoginStatus1" OnLoggedOut="LoginStatus1_LoggedOut" 
                             LogoutText="<%$ Resources: EPiServer, login.logout %>" runat="server" />
        </div>
        <br />
</LoggedInTemplate>

 

cs code:

protected void LoginStatus1_LoggedOut(object sender, EventArgs e)
{
            Utilities.LogToFile("[Default_ LoginStatus1_LoggedOut _] ");
// ...
             //FormsAuthentication.SignOut();             //Roles.DeleteCookie();             //Session.Clear();  }

 

Any idea to fix it?

Thanks.




 

 

#57833
Mar 29, 2012 18:01
Vote:
 

Hi again .. So what about just writing "Good Bye" when any user logout?

Can Anyone answers me then !

My main problem is that i can't catch the logout event !

otherwise why it wouldn't call the LoginStatus1_LoggedOut method ?

Thanks

#57949
Apr 04, 2012 18:05
Vote:
 

Hi Bilel.

I tried your code (except the write to file part) and for me it worked, the event fired. are you sure that you don`t do any databind or other things that can mess things up in some other part for example the master page?

Try the code on an empty page where nothing can interfere and work your way from there.

best of luck!

#57952
Apr 04, 2012 21:45
Vote:
 

I would try to do it on the LoggingOut-event instead. If you allready are logged out, I guess it will be pretty hard to get the username from the logged out person. And if you are at a "restricted" page when logging out, will you ever reach the LoggedOut-event?

#57955
Apr 05, 2012 9:02
Vote:
 

Hi,

@Erik Nordin:

Yes as you sayed, LoggingOut event is more convignient.. it's just to see if it was triggered or not !

thanks anyway !

@ Mikael Jönsson

Well i am newbie about handling/dealing with Master pages .. so if there any thing that i should verify in it, just tell !

i tested the same code using google chrome and it worked just fine .. but not with Firefox

i do not know why ?! Do you have any idea?

#58060
Apr 12, 2012 11:51
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.