Knowledgebase

Home > Item #168

No items get added to the basket when I click 'add to basket' or the items disappear when the page refreshes

Item: #168
Date: 2 Apr 2002
Applies to
v4
v5

Question

I have a customer who has a problem with adding items to the CactuShop basket. Everytime he adds an item to the basket, it refreshes with nothing in it! I have other clients who are using the shop successfully. What is happening?

Answer

This is most likely a cache problem. Pages can be stored on disk so that when the user accesses the page again, the stored version is served back instead of using bandwidth getting the page a second time.

Caching can occur both within the browser (check browser settings) and also at proxy servers, but ASP pages are generally not cached because they are dynamic.

Try adding these lines to the config.asp file, around line 44:

Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "cache-control","private"
Response.Expires = 60
Response.Expiresabsolute = Now() - 2


It is still possible that a proxy server or browser could be set to override these 'no cache' commands, but the code should eliminate most problems. These lines were incorporated into CactuShop as default from v4.506 onwards but this caused problems with accessing pages in the history, so they were removed. They are however a good test that caching is the problem.

If you add these lines, the cached pages will still remain. So you need to clear your browser cache and any other caches along route.

Ensure your browser is not set to cache ASP pages.

Can't find the answer you need? Click here to open a support ticket.

« Back