Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing problem

Status
Not open for further replies.

xue

Programmer
Feb 5, 2001
12
0
0
US
I have a problem with browser refresh, every time it refreshes, my qty in the cartitem table(sql database) add 1.
I have tried :
Response.buffer = true
response.clear
response.redirect request("script_name")

from a book, it uses COM object and also suggested to put it on top of the asp page, above it, it is only a condition check and add an item(mine is in the middle of the page). it is not working. I also tried:
<%Response.Expires = -1
Response.Expires = 0%> 'on very top
<meta http-equiv=&quot;PRAGMA&quot; value=&quot;NO-CACHE&quot;><BR>
<meta http-equiv=&quot;Expires&quot; content=&quot;Mon, 01 Jan 1990 12:00:00 GMT&quot;><BR> 'the next

which is suggested from previous page, but is also not working. my code structure is like this:
......
if clicked update button then
....
if clicked continue button then
....
if you are first time in here then
insert datas into the cart page
insert datas into the cartitems page
elseif you are here before but not clicking the update
button then
loop compare the datas in database with the datas
from link
if it matches, update the cart
if not matches, insert at the end of the database
end if

the insertcart function
...
the updatecart function

my code is only asp w/o COM, can anybody help me on how to solve the refresh problem? thank you very much.



 
this method:
response.redirect request(&quot;script_name&quot;)
could have worked if you made your script dependent upon a form/querystring value to perform the add. For example, if you had a form/querystring value named 'action' and you only added to cart when action = &quot;add&quot;. Once you perform the add operation then response.redirect back to the same page, thus losing the form/querystring value in the process. Your script will see that action = &quot;&quot; and it will drop through the script and display the page. Form/querystring values always get submitted to a page and are not affected by the cache.

You could also response.redirect to a pure script page ( i.e. add.asp ) and have it direct back to the cart page after performing the add. This is similar to a Site Server ghost page.

JAC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top