RedirectFromLoginPage, but somewhere else

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any possibility to redirect user (after having authenticated him
to some custom aspx page, not the original that he requested and whic
caused him to be shown the logon screen

now, I call

if(IsAuthenticated(user,password)

FormsAuthentication.RedirectFromLoginPage(user,false)


I would like however, that I could call something like that

if(IsAuthenticated(user,password)

MarkUserAsAuthenticated(user) //attach some cookie or something.
RedirectToCustomURL(user,false);//goto custom page, not necesserily the original that redirected the user her

//the above two lines are currently merged into one (formsAuth.RedirectFrom..()
//but this does not allow me to tell where the user should go..


Thanks for hel
Michał
 
Hi, Michal Januszczyk,

You can call FormsAuthentication.SetAuthCookie(string, bool) and then simply
Response.Redirect the user where you want to.

Hope this helps
Martin
Michal Januszczyk said:
Is there any possibility to redirect user (after having authenticated him)
to some custom aspx page, not the original that he requested and which
caused him to be shown the logon screen ?

now, I call :

if(IsAuthenticated(user,password))
{
FormsAuthentication.RedirectFromLoginPage(user,false);
}


I would like however, that I could call something like that:

if(IsAuthenticated(user,password))
{
MarkUserAsAuthenticated(user) //attach some cookie or something..
RedirectToCustomURL(user,false);//goto custom page, not necesserily the
original that redirected the user here
 
You can just call good old fashioned Response.Redirect and redirect them to
wherever you want. No one says you have to call RedirectFromLoginPage.

I think the user already has to have been marked as authenticed before
RedirectFromLoginPage, or else that would fail. That method is just a
convenient way to redirect them to their originally requested URL, I dont'
believe it actually does anything to mark the user as authenticated.

Michal Januszczyk said:
Is there any possibility to redirect user (after having authenticated him)
to some custom aspx page, not the original that he requested and which
caused him to be shown the logon screen ?

now, I call :

if(IsAuthenticated(user,password))
{
FormsAuthentication.RedirectFromLoginPage(user,false);
}


I would like however, that I could call something like that:

if(IsAuthenticated(user,password))
{
MarkUserAsAuthenticated(user) //attach some cookie or something..
RedirectToCustomURL(user,false);//goto custom page, not necesserily the
original that redirected the user here
 

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

Back
Top