Asp.net 对不同的主机进行身份验证
嗨,我的网站有表单认证,它在localhost和godaddy上运行良好,但在移动到另一个主机后,它停止工作。 在管理员区登录2-3分钟后,我重定向回登录屏幕。 有人知道我是否更改了IIS的某些设置,或者问题的根源是什么吗? 我的代码看起来像Asp.net 对不同的主机进行身份验证,asp.net,asp.net-mvc,authentication,forms,Asp.net,Asp.net Mvc,Authentication,Forms,嗨,我的网站有表单认证,它在localhost和godaddy上运行良好,但在移动到另一个主机后,它停止工作。 在管理员区登录2-3分钟后,我重定向回登录屏幕。 有人知道我是否更改了IIS的某些设置,或者问题的根源是什么吗? 我的代码看起来像 <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="10000" slidingExpiration="true"/> </auth
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="10000" slidingExpiration="true"/>
</authentication>
FormsAuthentication.SetAuthCookie(userName, rememberMe);
FormsAuthentication.SetAuthCookie(用户名,rememberMe);
如果您的应用程序域正在关闭,并且Web.config中没有machineKey部分(或validationKey/decryptionKey=“AutoGenerate”),则在每次应用程序启动后,您将获得新的validationKey/decriptionKey,身份验证cookie将变为无效。访问并将生成的machineKey部分添加到Web.config中。这完全救了我一命。谢谢