窗体身份验证跨多个服务器的执着 [英] forms authentication persistent across multiple servers

查看:162
本文介绍了窗体身份验证跨多个服务器的执着的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC 2.0应用程序使用窗体身份验证这是负载两个服务器之间的平衡需要一个持久登录(如果选择)。

I have an MVC 2.0 application that requires a persistent login(if chosen) using forms authentication which is load balanced between two servers.

我的webconfig(两台服务器上)看起来像这样:

my webconfig(on both servers) looks like so:

<authentication mode="Forms">
   <forms name="MA_AuthCookie" loginUrl="~/Account/LogOn" timeout="86400" protection="All"   path="/" slidingExpiration="false"/>
</authentication>

<machineKey   validationKey="*************180C6E1FD3E9338B78ACD83CA0A99F27B985AF97871BDBA43E1426DB8FA82F811779BFB779D1E90EB9BCCDE71D3F0458392736B17D3" 
decryptionKey="*****************D72F47EF06B1F594CAAF1BEA311555A9D8E8" 
                validation="SHA1" 
                decryption="AES" />

超时时间设置为60天,我使用下面的脚本设置登录cookie的。

timeout is set for 60 days and i am using the following script to set the cookie on login.

 FormsAuthentication.SetAuthCookie(userName, true);

所有的伟大工程,或因此它似乎在这两个服务器,直到我回来一小时左右后没有活动,我的身份验证cookie将消失。我不知道这有什么做的工作进程要么负载平衡服务器上的应用程序,因为我可以直接到服务器,登录之一,我登录被持久化,因为它应该是。此外,通过我的调查结果的事实,我设置的机器验证关键是应该解决的关键问题和娱乐的工作进程运行时。一定有什么东西我失踪。如果任何人都可以在正确的方向指向我这将是非常美联社preciated。

All works great or so it seems across both servers until i come back an hour or so later with no activity and my auth cookie is gone. I am not sure this has something to do with the worker process on either load balanced server for the application because i can go directly to one of the servers, login and my login is persisted as it should be. Also, through my findings the fact that i am setting a machine validation key is supposed to get around the issue and recreation of keys when the worker process runs. There must be something i am missing. If anyone can point me in the right direction it would be very appreciated.

谢谢,
比利

推荐答案

看起来像我未能实现明显。虽然它仿佛在关闭浏览器时,有时会下降,有时不是在我的Firefox浏览器中检查会议结束时到期的cookie设置的登录将持续。一切都使得这种变化之后好。

Looks like i failed to realize the obvious. Although it seemed as though the login would persist when closing the browser down sometimes and sometimes not the setting to expire cookies at the end of the session was checked on my firefox browser. All is good after making that change.

这篇关于窗体身份验证跨多个服务器的执着的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆