I have a WCF web-service and a Silverlight app displaying data from that service. In my service I'd like to implement automatic logout of the user, if no service methods were invoked during a period of time (for example 20 minutes).
I'm thinking about smth like that:
Dictionary<User,TimeS开发者_Python百科pan> Inactivity
When a service method is invoked i reset the TimeSpan. But what will happen, if 20 minutes pass, and I call the Logout method (which clears all User caches), and suddenly the User returns from lunch)) and presses a button in his Silverlight app? Obviously he'll get an error. Is there any way to avoid this, or all my concept is wrong? Maybe there's a better way to logout the user automatically?
20 mins passes, Logout method runs, user's redirected to a login page, user comes from lunch, sees a login page with a message that his session has expired, enters username/password, logs in.
精彩评论