asp.net“记住我”不能与窗体身份验证工作了 [英] asp.net 'Remember me' not working anymore with forms authentication

查看:126
本文介绍了asp.net“记住我”不能与窗体身份验证工作了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个网站,自书面会员供应商是在不同的网络应用程序和不同的应用程序池相同的Web在同一台服务器上hostet。

I have two websites with self written membership providers that are hostet on the same server in the same Web in different web-applications and different application pools.

以前我有问题,我不能在这两个网站登录在一起。由于雷米的<一个href=\"http://stackoverflow.com/questions/4711523/two-different-asp-net-membership-providers-on-the-same-web-solution\">post,这个工程现在,我不得不添加名称 -attribute到表格元素。结果
但现在我有一个asp的登录控制的记得,我选择停止正常工作的问题。正常的会话超时后,用户被注销。

Formerly I had the problem, that I could not log on on both sites together. Thanks to Remy's post, this works now, I had to add the name-attribute to the forms element.
But now I have the problem that the remember-me option of the asp login-control stopped to work. The user is logged off after the normal session-timeout.

在web.config文件的外观认证的属性如下:

The authentication-attributes in the web.config file look as follows:

<authentication mode="Forms" >
  <forms loginUrl="~/UserMgmt/Login.aspx" timeout="400000" slidingExpiration="true" name="NameOfTheSite"/>
</authentication>

也有我的方式authetication以不同的名称设置cookie名称。

Also have I set the cookie name for the forms authetication to different names.

有没有别的东西,我要补充,使记得,我拥有的作品?

Is there something else that I have to add, so that the remember-me feature works?

更新结果
我观察到,如果我禁用加密和验证窗体身份验证cookie的,问题就消失了。如果我要么激活加密,验证或两者兼而有之,新出现问题。结果
我也知道,它的独立的会话cookie名称(他们甚至可以是相同的)的。也许这些信息可以帮助别人弄清楚这是怎么回事?

Update
I have observed that if I disable encryption and validation for the forms authentication-cookie, the problem is gone. If I either activate encryption, validation or both, the problem occurs newly.
I know also, that it's independent of the session-cookie names (they even could be identical). Maybe this information helps someone to figure out what's going on?

更新1 结果
感谢Jason Kealey为解决这一问题。我永远不会发现它。
在此期间,我发现在MSDN中的相应信息。在
如何配置的machineKey在ASP.NET 2.0
参见Web场部署注意事项所记:

Update 1
Thanks to Jason Kealey for the solution to this problem. I would never had found it. In the meantime I've found the corresponding information in msdn. In How To: Configure MachineKey in ASP.NET 2.0 in the section "Web Farm Deployment Considerations" is written:

如果你想在同一服务器上其他应用程序的应用程序隔离,将&LT;的machineKey&GT; 在Web.config文件中为每个应用程序上场中的每个服务器。确保您使用单独的键值为每个应用程序,但场中复制的所有服务器每个应用程序的密钥。

If you want to isolate your application from other applications on the same server, place the <machineKey> in the Web.config file for each application on each server in the farm. Ensure that you use separate key values for each application, but duplicate each application's keys across all servers in the farm.

推荐答案

这个问题可能是你有在每次启动的工作进程时自动生成验证密钥。该Cookie是加密的,但是当你再回来使用新的服务器端密钥,因此你的cookie不会被解密。

The issue may be that you have validation keys that are automatically generated every time you launch the worker process. The cookie is encrypted, but when you come back a new server-side key is used and thus your cookie cannot be decrypted.

退房的machineKey节
<一href=\"http://msdn.microsoft.com/en-us/library/ff649308.aspx\">http://msdn.microsoft.com/en-us/library/ff649308.aspx

Check out the machineKey section http://msdn.microsoft.com/en-us/library/ff649308.aspx

下面是一些将生成的machineKey节为你
<一href=\"http://www.qualitydata.com/products/aspnet-membership/help/configuration/no-machinekey.aspx\">http://www.qualitydata.com/products/aspnet-membership/help/configuration/no-machinekey.aspx

Here is something that will generate the machineKey section for you http://www.qualitydata.com/products/aspnet-membership/help/configuration/no-machinekey.aspx

这篇关于asp.net“记住我”不能与窗体身份验证工作了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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