【发布时间】:2011-12-11 04:07:12
【问题描述】:
我们在使用 Safari(和 Opera)时遇到问题,据我所知,FedAuth cookie 太大了。
有一个“巧妙的技巧”可以解决这个问题: “WIF RTM 向 SessionAuthenticationModule 添加了一个属性 IsSessionMode。当翻转为 true 时,IsSessionMode 具有确保 SessionSecurityToken 在整个会话期间保留在缓存中并生成仅包含会话标识符而不是会话本身的内容。”
我在 global.asax 中有这段代码:
void WSFederationAuthenticationModule_SessionSecurityTokenCreated(object sender, Microsoft.IdentityModel.Web.SessionSecurityTokenCreatedEventArgs e)
{
FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true;
}
问题,“FederatedAuthentication.SessionAuthenticationModule.IsSessionMode = true”永远不会运行......为什么?
将IsSessionMode设置为true是否与“PassiveSignInControl”有关?
your-fedauth-cookies-on-a-diet-issessionmode-true.aspx
摘自《Programming Windows® Identity Foundation》一书:
“SAM 的一个有趣属性是 IsSessionMode。当设置为 true,IsSessionMode 具有存储大部分会话的效果 在服务器端令牌缓存上,而不是将所有内容写入 曲奇饼。 cookie 本身将只包含一个小上下文 标识符,将用于在 服务器。不幸的是,在这个版本的 92 Part II Windows Identity Developers 产品的 Identity Foundation 没有办法 从配置文件中设置 IsSessionMode。你可以通过一个 PassiveSignInControl 的属性,或在 global.asax 文件中作为 如下(与上面相同的代码)”
【问题讨论】:
-
好的,读完这条评论后听起来好像我很久没有尝试过这个了,但事实并非如此。我认为每次用户登录时都会运行“WSFederationAuthenticationModule_SessionSecurityTokenCreated”,现在它以“随机”的方式运行并长时间刹车。它可能在更新 cookie 时正在运行。 “WSFederationAuthenticationModule_SessionSecurityTokenCreated”应该什么时候运行??
标签: c# web-applications wif