Login of different user after Logout

Discussion in 'ASP .Net' started by Michael Groeger, Aug 19, 2005.

  1. Hi,

    I have implemented a simple page for FormsAuthentication and when user data
    is accepted I redirect the user using
    FormsAuthentication.RedirectFromLoginPage().

    private void btnLogin_Click(object sender, System.EventArgs e)
    {
    // [...]
    FormsAuthentication.RedirectFromLoginPage(username, false);
    }

    The application the user enters has a logout button, which calls
    Session.Abandon() and FormsAuthentication.SignOut() when clicked and then
    redirects the user to the main page of the application, which causes the
    login page to show up again.

    private Page_Load(object sender, System.EventArgs e)
    {
    Session.Abandon();
    FormsAuthentication.SignOut();
    Response.Redirect("main.aspx");
    }

    So far so good, when I now enter the application with the same user again,
    everything works fine, but when I try to login another user, I always get
    back to the login page. I also tried to do login by hand, but with the same
    effect:

    private void btnLogin_Click(object sender, System.EventArgs e)
    {
    // [...]
    FormsAuthentication.SetAuthCookie(username, false);
    string url = FormsAuthentication.GetRedirectUrl(username, false);
    Response.Redirect(url);
    }

    So what am I doing wrong here?

    Regards,
    Michael
     
    Michael Groeger, Aug 19, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dmE=?=

    RE: Logout status doesn't really logout?

    =?Utf-8?B?dmE=?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    593
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
  2. =?Utf-8?B?RFdT?=

    RE: Logout status doesn't really logout?

    =?Utf-8?B?RFdT?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    590
    =?Utf-8?B?RFdT?=
    Mar 26, 2006
  3. =?Utf-8?B?dmE=?=

    Logout status doesn't really logout?

    =?Utf-8?B?dmE=?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    701
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
  4. Gregory A. Beamer
    Replies:
    0
    Views:
    401
    Gregory A. Beamer
    Jan 15, 2009
  5. Author
    Replies:
    1
    Views:
    542
    Author
    Jan 15, 2009
Loading...

Share This Page