Redirect to different site after login

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Redirect to different site after login

Post by jmestep » Mon Aug 10, 2009 2:39 pm

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?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Redirect to different site after login

Post by jmestep » Tue Aug 11, 2009 7:14 am

I got it working with this code:
string currentReferrerUrl = Request.Cookies["NRAReferrerUrl"].Value;
FormsAuthentication.SetAuthCookie(UserName.Text, false);
Response.Redirect(currentReferrerUrl);
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: Redirect to different site after login

Post by heinscott » Thu Dec 17, 2009 10:20 am

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

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Redirect to different site after login

Post by jmestep » Thu Dec 17, 2009 2:33 pm

Wow, it pays to talk to myself! :D
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply