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.

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") %>

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.

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.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.