Implementation of Auto Logoff based on User Inactivity in WPF Application

In some applications, we need to implement Auto logoff feature for security reason. In auto log off feature, the application redirects the user into login window, if the user remains inactive for a certain amount of time. I have just published how I came up with implementing auto logoff feature based on user inactivity in WPF application.

Here it is:

http://www.codeproject.com/KB/WPF/AutologoffWPF.aspx

2 Comments

  • Hi, i'm ussing Windows Form Application,

    i can't use this translated function because interop isn't a member of windows,

    Public Shared Sub StartAutoLogoffOption()

    System.Windows.Interop.ComponentDispatcher.ThreadIdle += New EventHandler(AddressOf DispatcherQueueEmptyHandler)
    End Sub
    Private Shared Sub _timer_Tick(ByVal sender As Object, ByVal e As EventArgs)
    If _timer IsNot Nothing Then
    System.Windows.Interop.ComponentDispatcher.ThreadIdle -= New EventHandler(AddressOf DispatcherQueueEmptyHandler)
    _timer.[Stop]()
    _timer = Nothing

    RaiseEvent MakeAutoLogOffEvent()
    End If
    End Sub


    please help!!!!

  • Hi,

    This may be not the right thread for my comments but I cant find a suitable one, so plz all me to leave it in this thread only.

    I have a wired scenario in one of my ASP.net application.

    I am using ASP.net membership with my custom "roleManager",

    and having below tag in web.config to restrict any user not having role of "Keywords"(roles) to access "Keywords"(path) folder

    <location path="Keywords">

    <system.web>

    <authorization>

    <allow roles="Keywords"/>

    <deny users="*" />

    </authorization>

    </system.web>

    </location>

    If any user with some other role allow to assess this URL (Keywords in this case) will be redirected to a custom- Access denied page.

    Now things working fine but when I left my application with a inactivity of 30 min I am not able to visit the "Keywords", all the time I end up with the custom- Access denied page, if I close the browser, login again it start working fine.

    Please help me in this case.

    Thanks in advance

Comments have been disabled for this content.