1,105,214 Community Members

Logout then redirect to home page

Member Avatar
phingko
Newbie Poster
7 posts since May 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
urtrivedi
Posting Virtuoso
1,897 posts since Dec 2008
Reputation Points: 249 [?]
Q&As Helped to Solve: 408 [?]
Skill Endorsements: 27 [?]
 
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") %>

Member Avatar
JorgeM
IT Addict
6,387 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 956 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

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.

Member Avatar
phingko
Newbie Poster
7 posts since May 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
urtrivedi
Posting Virtuoso
1,897 posts since Dec 2008
Reputation Points: 249 [?]
Q&As Helped to Solve: 408 [?]
Skill Endorsements: 27 [?]
 
0
 

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

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

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: