2

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

 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
        }

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

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

4

1 回答 1

0

(在问题编辑中回答。转换为社区 wiki 答案。请参阅将问题的答案添加到问题本身时的适当操作是什么?

OP写道:

谢谢@Aristos。通过在 web.config 第一个项目上使用以下代码解决了该问题

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

第二个项目

<authentication mode="Forms">
     <forms name=".Cookie2" ... />
    </authentication>
于 2015-02-07T20:06:07.277 回答