Question about redirecting a user after authentication

  • Thread starter Thread starter Simon Harvey
  • Start date Start date
S

Simon Harvey

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
 
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.
 
Fluker said:
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
 
Back
Top