Question about redirecting a user after authentication

Discussion in 'ASP .Net' started by Simon Harvey, Feb 18, 2004.

  1. Simon Harvey

    Simon Harvey Guest

    Hi,

    This is a very typical requirement so I'm sure the answer is very
    straightforward.

    If a user tries to get to a secure directory, they can be a sent to a login
    page automatically. Once the user has been authenticated, a call to,
    FormsAuthentication.RedirectFromLoginPage()
    will send the user to the page he had been originally trying to reach.

    Good. Thats very handy and something I definately want to use. The problem
    is, what do I do when the user navigates directly to the login page of
    his/her own accord. In this case,
    when the user is authenticated, I might want to just send them to a default
    page.

    My question is, how do I detect whether or not I should use
    RedirectFromLoginPage() or another method that just redirects the user to a
    page of my choosing.

    I hope that makes sense! Thank you to anyone who can help me with this

    Simon
     
    Simon Harvey, Feb 18, 2004
    #1
    1. Advertising

  2. Simon Harvey

    Fluker Guest

    Hi,

    RedirectFromLoginPage() works just fine. If you redirect to login
    page manually, make sure that a querystring "ReturnURL" is appended to
    URL with value of ApplicationPath + "/" + "yourpage.aspx", and this value
    is server encoded. Once login is validated it will automatically redirect
    user
    to page in that querystring. If returnURL is absent then
    RedirectFromLoginPage
    redirects to "default.aspx" in base directory.

    Hope this helps,

    FLU.

    "Simon Harvey" <> wrote in message
    news:...
    > Hi,
    >
    > This is a very typical requirement so I'm sure the answer is very
    > straightforward.
    >
    > If a user tries to get to a secure directory, they can be a sent to a

    login
    > page automatically. Once the user has been authenticated, a call to,
    > FormsAuthentication.RedirectFromLoginPage()
    > will send the user to the page he had been originally trying to reach.
    >
    > Good. Thats very handy and something I definately want to use. The problem
    > is, what do I do when the user navigates directly to the login page of
    > his/her own accord. In this case,
    > when the user is authenticated, I might want to just send them to a

    default
    > page.
    >
    > My question is, how do I detect whether or not I should use
    > RedirectFromLoginPage() or another method that just redirects the user to

    a
    > page of my choosing.
    >
    > I hope that makes sense! Thank you to anyone who can help me with this
    >
    > Simon
    >
    >
     
    Fluker, Feb 18, 2004
    #2
    1. Advertising

  3. Simon Harvey

    Simon Harvey Guest

    "Fluker" <> wrote in message
    news:...
    > Hi,
    >
    > RedirectFromLoginPage() works just fine. If you redirect to login
    > page manually, make sure that a querystring "ReturnURL" is appended to
    > URL with value of ApplicationPath + "/" + "yourpage.aspx", and this value
    > is server encoded. Once login is validated it will automatically redirect
    > user
    > to page in that querystring. If returnURL is absent then
    > RedirectFromLoginPage
    > redirects to "default.aspx" in base directory.
    >
    > Hope this helps,
    >
    > FLU.
    >



    Hi Mr Flu,

    Thanks for your help. It was that last line in your reply that I was
    needing!

    Thanks
    Simon
     
    Simon Harvey, Feb 18, 2004
    #3
    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. Pradeep Pise
    Replies:
    0
    Views:
    530
    Pradeep Pise
    Jul 9, 2004
  2. AVance
    Replies:
    1
    Views:
    3,118
    AVance
    Jul 28, 2004
  3. darrel
    Replies:
    5
    Views:
    442
    =?Utf-8?B?S2VubmV0aCBQ?=
    Dec 11, 2004
  4. Jeremy
    Replies:
    1
    Views:
    354
  5. Replies:
    0
    Views:
    160
Loading...

Share This Page