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. Advertising

  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. 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. Brian Henry

    Forms Login/Logout

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

    Login of different user after Logout

    Michael Groeger, Aug 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    393
    Michael Groeger
    Aug 19, 2005
  3. =?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:
    577
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
  4. =?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:
    571
    =?Utf-8?B?RFdT?=
    Mar 26, 2006
  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:
    684
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
Loading...

Share This Page