Page 1 of 1

Redirect to different site after login

Posted: Mon Aug 10, 2009 2:39 pm
by jmestep
I am having to do a redirect to the referring Url from the login button on the login page. I've got it picking up the referrer Url (not a store page) and they want the customer redirected back to that page after login. I can't use the default code below because the url might not be a store url, it might be just an html url.
Instead of
FormsAuthentication.RedirectFromLoginPage(UserName.Text, false); //doesn't work because url is from outside
I'm using
string currentReferrerUrl = Request.Cookies["NRAReferrerUrl"].Value;//custom cookie
Response.Redirect(currentReferrerUrl);
and it does the redirect fine, but it doesn't log them in before the redirect.
How can I automatically log them in?

Re: Redirect to different site after login

Posted: Tue Aug 11, 2009 7:14 am
by jmestep
I got it working with this code:
string currentReferrerUrl = Request.Cookies["NRAReferrerUrl"].Value;
FormsAuthentication.SetAuthCookie(UserName.Text, false);
Response.Redirect(currentReferrerUrl);

Re: Redirect to different site after login

Posted: Thu Dec 17, 2009 10:20 am
by heinscott
Thanks Judy! I couldn't figure out how to login without a redirect for the life of me.
As always, I appreciate your contribution to these forums!

Scott

Re: Redirect to different site after login

Posted: Thu Dec 17, 2009 2:33 pm
by jmestep
Wow, it pays to talk to myself! :D