Session.Abandon() can't logout

Discussion in 'ASP .Net' started by ad, Nov 3, 2005.

  1. ad

    ad Guest

    I use the Login controls of Asp.net 2.0 in my program.
    I want to logout a user by program, I try Session.Abandon() for this.
    But I found that the user is the same after I execute Session.Abandon().

    I thought that Session.Abandon() can break the connection of current user,
    but I fail

    How can I logout a user by program?
     
    ad, Nov 3, 2005
    #1
    1. Advertisements

  2. You would rather invoke
    System.Web.Security.FormsAuthentication.SignOut().

    Forms authentication uses cookies. This method will remove the cookie
    from the browser.

    I have barely touched ASP.NET 2.0 but this method is supported in both
    framework 1.0, 1.1 and 2.0.

    Correct me if I am wrong!
     
    Emil Christopher Melar, Nov 3, 2005
    #2
    1. Advertisements

  3. ad

    George Guest

    Never worked with ASP.NET but have 2 educated guesses where is the problem.

    1. Session.Abandon only takes effect after page is completely executed. So the current page that called Abandon still has that same session. All next browser calls will be on a new Session

    2. Is it possible that you are using AutoLogin feature. It will immediately log you back in as soon as you logout.


    George.
    I use the Login controls of Asp.net 2.0 in my program.
    I want to logout a user by program, I try Session.Abandon() for this.
    But I found that the user is the same after I execute Session.Abandon().

    I thought that Session.Abandon() can break the connection of current user,
    but I fail

    How can I logout a user by program?
     
    George, Nov 3, 2005
    #3
  4. ad

    ad Guest

    Thanks,
    Your are correct!
    SignOut() really can logout a user!

    What about Session.Abadon()?
    What dose it can do for us?
     
    ad, Nov 3, 2005
    #4
  5. ad

    Bruce Barker Guest

    authenication and session are different. authenication is who the user is.
    session is a way to attach server state information to a browser session.
    they are indepentant of each other and neither requires the other.

    so session abandon frees the session data only.

    -- bruce (sqlwork.com)



    session abandon, clears the session
     
    Bruce Barker, Nov 3, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.