We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,134 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Logout then redirect to home page

Hi all,

Can anyone please help me solving this code that i've been stuck for a while.

I would like to logout from my shopping website then redirect the user to homepage after that. Right now, I managed to log them out but everytime they log out, it will bring them to view_cart.asp page.

And I want to redirect them to front.htm.
Can anyone please guide me how to do it?

I have code as below for the moment;

...
if (window.loginFirstName && window.loginFirstName.length) {
document.write('Welcome <a font class="login" color'+eQ+'"red"  href'+eQ+'"javascript:window.location.href=MyAccount.replace(\'login.asp\',\'login.asp\') + \'&amp;sitename=\' + escape(sitename)" >' + window.loginFirstName + ' ' + window.loginLastName + '</a></font>! ');

document.write('<a class="login" href' + eQ + '"JavaScript:window.location' + eQ + 'MyAccount.replace(\'Auto' + eQ + 'Off\',\'opener' + eQ + 'null\')+\'&amp;action' + '' + eQ + 'logout&amp;sitename=\'+escape(sitename)+\'&amp;GoBack' + eQ + '\'+escape(window.location)">LOGOUT</a>');

......

Thanks in advanced.

3
Contributors
4
Replies
1 Day
Discussion Span
6 Months Ago
Last Updated
5
Views
phingko
Newbie Poster
7 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

try to do that in asp code
may be in logout.asp (if it exists) or where where u destryoing session, there u put following line

<% Response.Redirect("front.htm") %>

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

but everytime they log out, it will bring them to view_cart.asp page

Where is the logic in your code that redirects the user to the view_cart.asp page? It would probably be easier to handle the log out with the redirect to your home page in ASP.

JorgeM
Industrious Poster
4,017 posts since Dec 2011
Reputation Points: 294
Solved Threads: 548
Skill Endorsements: 115

Thanks for the suggestions and reply.

Sorry, it's not actually direct users to view_Cart.asp. but it will go back to previous page where the user is. If they log out from front.htm then it will take them back to front.htm.
If they log out from contact us page then it will direct them back to contact us page.

I can't change the code to asp since this code is provided by the cms system. I just don't want to make a lot of changes as I afraid I will change something and the website won't work at all.

It only has login.asp.

phingko
Newbie Poster
7 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I guess if you have logout.asp, you can write this code in it

<% Response.Redirect(Request.ServerVariables("HTTP_REFERER")) %>

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0694 seconds using 2.67MB