开发者

Implementing automatic logout in silverlight and wcf due to user inactivity

开发者 https://www.devze.com 2022-12-25 12:29 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号