Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 子域身份验证_C#_Asp.net_Authentication_Forms Authentication - Fatal编程技术网

C# 子域身份验证

C# 子域身份验证,c#,asp.net,authentication,forms-authentication,C#,Asp.net,Authentication,Forms Authentication,我正在使用默认的ASP.NET身份验证解决方案。现在我的服务器上有了子域(例如example.com、blog.example.com、forum.example.com…),登录发生在example.com上,并发出一个身份验证cookie。但当我进入forum.example.com时,我会被重定向到登录。是否有使*.example.com登录工作的配置设置 值得注意的是,cookies是作为域的“example.com”发布的。因此,根据一些阅读,我将其改为“.example.com”,现

我正在使用默认的ASP.NET身份验证解决方案。现在我的服务器上有了子域(例如example.com、blog.example.com、forum.example.com…),登录发生在example.com上,并发出一个身份验证cookie。但当我进入forum.example.com时,我会被重定向到登录。是否有使*.example.com登录工作的配置设置

值得注意的是,cookies是作为域的“example.com”发布的。因此,根据一些阅读,我将其改为“.example.com”,现在子域身份验证可以工作了。有人能够解释吗?

根据,如果您没有在域上添加点前缀,则该点无效,应拒绝cookie。 从

域=域 可选。“域”属性指定要为其指定域的域 cookie是有效的。明确指定的域必须始终启动 带点


但是ASP.NET的身份验证cookie不是以点开头的;“company.com”我很困惑,你从哪里得到“company.com”的价值?这就是一个例子。看看ASP.NET4的身份验证cookie,它被设置为“company.com”而不是“.company.com”。然而,根据你上面的评论,不在前面使用点是违反惯例的…?你有url吗?我怀疑这是个坏例子。无论哪种方式,你都需要圆点。可能重复的
4.3.2  Rejecting Cookies

   To prevent possible security or privacy violations, a user agent
   rejects a cookie (shall not store its information) if any of the
   following is true:

   * The value for the Path attribute is not a prefix of the request-
     URI.

   * The value for the Domain attribute contains no embedded dots or
     does not start with a dot.