Silverlight 4在表单身份验证cookie过期时引发事件

发布于 2024-11-04 15:24:50 字数 119 浏览 3 评论 0原文

当表单身份验证 cookie 过期时,我对如何在 silverlight 中触发事件感到困惑。我想立即将应用程序重定向到登录屏幕。我知道我可以等到 Web 服务调用失败,但我认为在输入数据后将用户重定向到登录的客户体验很差。

I am stumped on how to fire an event in silverlight when a forms authentication cookie expires. I would like to redirect the application to a login screen immediately. I understand I can wait until a web service call fails but I think redirecting the user to login after inputing data is poor customer experience.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春庭雪 2024-11-11 15:24:50

此 cookie 的默认超时时间为 30 分钟。这意味着如果超过 30 分钟没有与服务器通信,则 cookie 将过期并且用户将被注销。过期工作原理的实际实现有点复杂,但这是简单的版本(您可以找到此处描述的更复杂的行为:http://support.microsoft.com/kb/910439)。如果需要,您可以增加或减少该值(在 web.config 文件中),但不建议将其设置得太大。 cookie 的生命周期越长,有人窃取它并冒充用户的机会就越大。 Cookie 的寿命较短本质上是一种安全措施,只有在仔细考虑后才应更改。

来自使用 Silverlight 4 的专业商业应用程序,第 250 页

我想您可以在 MainPage 中创建一个计时器,如果计时器在 30 天内未更新,则自动重定向到登录分钟。我现在找不到引用,但我想我记得他还说过没有真正的方法来判断 cookie 何时过期。

This cookie has a default timeout of 30 minutes. That means that if there is no communication with the server for longer than 30 minutes, then the cookie will expire and the user will be logged out. The actual implementation of how the expiry works is a little more complicated, but this is the simple version (you can find the more complicated behavior described here: http://support.microsoft.com/kb/910439). You can increase or decrease this value if required (in the web.config file), but it’s not recommended to make it too big. The longer the lifetime of the cookie, the more chance someone would have to steal it and impersonate the user. The short lifespan of the cookie is essentially a security measure, and should only be changed after careful consideration.

From Pro Business Applications With Silverlight 4, Page 250

I guess you could make a timer in the MainPage and just automatically redirect to the login if the timer wasn't updated for 30 minutes. I can't find the quote right now but I think I remember he also said that there is no real way of telling when the cookie expired.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文