Question about redirecting a user after authentication

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
 
F

Fluker

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

Simon Harvey

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top