2

I have 2-3 web projects ( beginner ones). In all the websites I have a login control where a user can log in. When the user logins with correct info, I set the

 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;
 }

Up to here is fine, but the problem occurs when I login into 2 separate websites (local) at same time, and log out at any one of them. When I log out at one the other website is also logged out ( when refreshed). Following is the code I use when logging out.

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
        }

I can't see to find out what's the cause of it. I am also new to web development.

I would also like to know if this is the right way of logging in a user.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ruchan
  • 3,124
  • 7
  • 36
  • 72
  • Similar issue: http://stackoverflow.com/questions/2454623/multiple-applications-using-same-login-database-logging-each-other-out/2491686#2491686 – Aristos Sep 13 '12 at 06:39

1 Answers1

0

(Answered in a question edit. converted to a community wiki answer. See What is the appropriate action when the answer to a question is added to the question itself? )

The OP wrote:

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>
Community
  • 1
  • 1
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129