Click here to Skip to main content
13,052,494 members (77,284 online)
Rate this:
Please Sign up or sign in to vote.
Hi every body,

I want to execute some code but only when User is signed out,

User can signed out by many reasons:

1= when it press on sign out button.
2= when he close the explorer
3= when he go to another website
4= when session end

that is what i know, may be another reasons cause signed out (if you know tell me)

i want to know if there is some method that is always invoked when User is signed out by any reasons that i mentioned above.

Like Application_AuthenticateRequest method in Global.asax which invoke always every load of any page.

any reply is appreciated...
Posted 18-Oct-11 15:34pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


Try this...

// Note this is an  ImageClickEventArgs (image icon)
protected void btnClose_Click(object sender, ImageClickEventArgs e)
    Page.GetType().InvokeMember("Invoke_SignOut", System.Reflection.BindingFlags.InvokeMethod, null, Page, null);
public void Invoke_SignOut()
    // Your code event here todo...

Hope this could help...

Please remember to vote if could help...

MrProgrammer_78 18-Oct-11 22:22pm
Thanks, but this method will invoke only if user press on btnClose Button
Al Moje 18-Oct-11 22:53pm
That's right. Maybe you could browse some articles at code project. I had forgotten the link, but some times I read such article closing the explorer or may you find it on google...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can invoke the method onUnload of the page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 19 Oct 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100