c# - ASP.NET HeadLoginView 注销 单击。也退出其他本地网站

标签 c# asp.net .net authentication

我有 2-3 个 Web 项目(初学者的)。在所有网站中,我都有一个用户可以登录的登录控件。当用户使用正确的信息登录时,我设置了

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{

    if (CHUser.AunthencateLogin(Login1.UserName, Login1.Password))//Checks with database
        e.Authenticated = true;
    else
        e.Authenticated = false;
 }

到这里还好,但是当我同时登录到 2 个单独的网站(本地),并在其中任何一个注销时,问题就出现了。当我在一个网站注销时,另一个网站也被注销(刷新时)。以下是我在注销时使用的代码。

protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
    {
        Session.Clear(); //though logout works without this code. It is for other
 //sessions that are manually created by me
        }

我看不出是什么原因造成的。我也是网络开发的新手。

我还想知道这是否是登录用户的正确方式。

最佳答案

(在问题编辑中回答。转换为社区维基答案。参见 What is the appropriate action when the answer to a question is added to the question itself?)

OP 写道:

Thanks @Aristos. the problem was solved by using the following code on web.config 1st project

<authentication mode="Forms">
 <forms name=".Cookie1" ... />
</authentication>

2nd project

<authentication mode="Forms">
     <forms name=".Cookie2" ... />
    </authentication>

关于c# - ASP.NET HeadLoginView 注销 单击。也退出其他本地网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12400306/

相关文章:

c# - .Net XML 序列化问题

c# - 使用 C# 发送邮件,使用客户端发送 Lotus Notes

c# - 域驱动设计中上下文之间的通信

asp.net - IIS 错误,无法在 Web 服务器上启动调试

c# - .NET 可扩展的 Pub/Sub 服务实现

c# - 插入 View 返回受影响的 2 行

c# - ActionLinks 的 MVC 动态路由值

c# - 在 Windows 7 中隐藏桌面项目 - 不工作

asp.net - 在共享服务器上发布时获取 "System.Security.SecurityException: That assembly does not allow partially trusted callers"

c# - 如何在不遍历每个循环的情况下从字典对象中获取所有键(仅键)