gpt4 book ai didi

asp.net - 单点登录 SignOut 问题 : FormsAuthentication. SignOut() 不起作用

转载 作者:行者123 更新时间:2023-12-02 18:42:49 28 4
gpt4 key购买 nike

我使用了单点登录演示:http://www.codeproject.com/KB/aspnet/SingleSignon.aspx

我为这个演示添加了SignOut功能,但发现了一个问题:

当我设置 cookie.Domain 时,FormsAuthentication.SignOut() 不起作用,并且无法清除 cookie。

如果 cookie 尚未设置 cookie.Domain,则 FormsAuthentication.SignOut() 有效。

我使用了 C# asp.net。

有人可以告诉我一些使用 asp.net 的简单实用的单点登录和单点登录解决方案吗?

最佳答案

如果您对同一域和子域使用身份验证,请尝试在 web.config 中添加域名,而不是通过代码添加域。如果您使用此 web.config 条目,则无需编写任何代码

<authentication mode="Forms">

<forms loginUrl="~/Account/LogOn" timeout="2880" domain="abc.com"/>

</authentication>

此条目告诉 asp.net 引擎,身份验证 cookie 将用于 abc.com 的所有子域。尝试使用它,看看它是否有效。

关于asp.net - 单点登录 SignOut 问题 : FormsAuthentication. SignOut() 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1707545/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com