我使用Forms身份验证构建了一个小型ASP.NET mvc应用程序。我似乎无法从基域(比如people.com)到子域(abc.people.com)共享cookie /身份验证 我的意思是当我通过代码调试时,Request.Cookies对象没有任何,User.Identity.IsAuthenticated为false。
甚至奇怪的是它似乎适用于Internet Explorer(很奇怪啊??)但是对于Chrome和Firefox。
但是当我检查浏览器中的cookie时,我可以看到域名people.com存在cookie
我错过了一些非常明显的事情吗?
编辑:我正在使用OAuthWebSecurity登录。登录的代码是
OAuthWebSecurity.Login(result.Provider, result.ProviderUserId, createPersistentCookie: true);
web.config值为
<authentication mode="Forms">
<forms loginUrl="~/Account" timeout="2880" />
</authentication>
答案 0 :(得分:1)
如果没有看到您编写cookie的代码很难提供帮助,那么下面的Stackoverflow帖子可能会有所帮助Share cookies across domains
答案 1 :(得分:0)
向表单字段添加域属性,基本域值似乎已解决问题。
<authentication mode="Forms">
<forms loginUrl="~/Account"
timeout="2880"
domain="people.com"
/>