Login / Logout

Discussion in 'ASP .Net' started by MichaelR, Jan 5, 2005.

  1. MichaelR

    MichaelR Guest

    I have an asp.net application using forms authentication.

    1. It has a simple login page (login.aspx) that uses
    FormsAuthentication.RedirectFromLoginPage(. . . ).
    2. My application has a logout function that Redirects to signout.aspx.
    Signout.aspx invokes FormsAuthentication.Signout() when it loads.
    3. Signout.aspx also has a login button that redirects to my application
    page (index.aspx). Because the user is no longer authenticated, asp.net
    properly invokes the login.aspx page.
    4. If I login again using the same user id, no problem - I go right to
    index.aspx.
    5. However, if I login using a different user id, I get redirected to
    signout.aspx. I've tested the value of FormsAuthentication.GetRedirectUrl(.
    .. . ) and it is clearly setting the RedirectUrl to signout.aspx.

    Is there some way to prevent this from happening? Is it possible to set the
    RedirectUrl using my .Net code? Better yet, is there a recommended way to
    implement a login / logout function that will allow different user ids?
     
    MichaelR, Jan 5, 2005
    #1
    1. Advertisements

  2. MichaelR

    Karl Seguin Guest

    Instead of relying on RedirectFromLoginPage you can do the same via
    SetAuthCookie and a response.redirect. You can get the redirect URL via
    GetRedirectURL

    http://msdn.microsoft.com/library/d...ormsauthenticationclasssetauthcookietopic.asp

    and

    http://msdn.microsoft.com/library/d...rmsauthenticationclassgetredirecturltopic.asp

    HTH
    Karl



    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "MichaelR" <> wrote in message
    news:...
    > I have an asp.net application using forms authentication.
    >
    > 1. It has a simple login page (login.aspx) that uses
    > FormsAuthentication.RedirectFromLoginPage(. . . ).
    > 2. My application has a logout function that Redirects to signout.aspx.
    > Signout.aspx invokes FormsAuthentication.Signout() when it loads.
    > 3. Signout.aspx also has a login button that redirects to my application
    > page (index.aspx). Because the user is no longer authenticated, asp.net
    > properly invokes the login.aspx page.
    > 4. If I login again using the same user id, no problem - I go right to
    > index.aspx.
    > 5. However, if I login using a different user id, I get redirected to
    > signout.aspx. I've tested the value of

    FormsAuthentication.GetRedirectUrl(.
    > . . ) and it is clearly setting the RedirectUrl to signout.aspx.
    >
    > Is there some way to prevent this from happening? Is it possible to set

    the
    > RedirectUrl using my .Net code? Better yet, is there a recommended way to
    > implement a login / logout function that will allow different user ids?
    >
    >
    >
     
    Karl Seguin, Jan 5, 2005
    #2
    1. Advertisements

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. Ravikanth[MVP]

    Automatic logout after elapsed period

    Ravikanth[MVP], Aug 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    621
    Ravikanth[MVP]
    Aug 21, 2003
  2. Tuan

    Create Logout page with ASP.NET

    Tuan, Dec 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    6,315
    George Durzi
    Dec 17, 2003
  3. Brian Henry

    Forms Login/Logout

    Brian Henry, Jul 3, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,519
    swati254
    Jun 4, 2008
  4. Michael Groeger

    Login of different user after Logout

    Michael Groeger, Aug 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    476
    Michael Groeger
    Aug 19, 2005
  5. =?Utf-8?B?dmE=?=

    Logout status doesn't really logout?

    =?Utf-8?B?dmE=?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    874
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
  6. Author
    Replies:
    1
    Views:
    608
    Author
    Jan 15, 2009
  7. smita

    Login/Logout Problem

    smita, Feb 17, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    223
    Madan Nayak
    Feb 19, 2004
  8. Barry Margolin

    Login, fill in forms, logout

    Barry Margolin, Feb 19, 2004, in forum: Javascript
    Replies:
    3
    Views:
    315
    Lasse Reichstein Nielsen
    Feb 19, 2004
Loading...