我有两个应用程序,一个叫做www.domain.dk和一个m.domain.dk
它们都有一个登录函数(相同),但是如果您在m.domain.dk上登录并进入www.domain.dk,则需要记住您已经登录了。
问题来了..。
www抛出并错误地说它无法验证m站点设置的cookie数据,所以我开始调试代码,发现www加密FormsAuthenticationTicket时,加密的字符串比m站点长64个字符。
对于两个项目,web.config的以下部分是相同的
<machineKey validationKey="CF3D..." decryptionKey="A56..." validation="SHA1" decryption="AES" />
<authentication mode="Forms">
<forms name=".ASPXAUTH" domain=".domain.dk" timeout="20" enableCrossAppRedirects="true" path="/" protection="All" cookieless="UseCookies" />
</authentication>以下代码来自登录函数
var ticket = new FormsAuthenticationTicket(1, user.UserName, DateTime.Now, DateTime.Now.AddMinutes(20), false, string.Empty, "/");
var hashCookies = FormsAuthentication.Encrypt(ticket);www是一个老网站,所以我的主要问题是,除了我的FormsAuthentication.Encrypt之外,还有其他什么东西可以影响“web.config”吗?
发布于 2015-06-16 13:06:43
解决办法是增加
compatibilityMode="Framework20SP1"到MachineKey标记
https://stackoverflow.com/questions/30258990
复制相似问题