Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Back button complicates ASP shopping cart item removal

Reply
Thread Tools

Back button complicates ASP shopping cart item removal

 
 
Penny
Guest
Posts: n/a
 
      05-25-2005
Hi all,

I've built an online shopping cart using ASP Classic(based on a 'WebThang'
tutorial). The shop cart page (with table showing customers selected items
and costs) has only 3 buttons/links.

1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.

2: Remove Item(one next to each item in cart): Clears the selected item from
the session variable array redisplays the page.

3: Checkout: Proceeds nicely to the pages that collect the customers
details.

My Problem:

If the user clicks the 'Remove Item' link/button, the page efficiently
redisplays with the selected item removed from the list. However, if the
user then clicks either the 'Back to Shop' button or the browser Back button
(intending to continue shopping), the cart page redisplays showing the
removed item back in the list as it was before they removed it. Although the
session variable array remains correctly unaltered it is very confusing to
the user and will probably cause them to feel that their shopping list has
been 'messed up' and is now invalid.

I understand that the browser is just 'doing what it is told' but need to
find a way to avoid this confusing behaviour.

Any ideas,

Regards

Penny.


 
Reply With Quote
 
 
 
 
Mark J. McGinty
Guest
Posts: n/a
 
      05-25-2005

"Penny" <> wrote in message
news:...
> Hi all,
>
> I've built an online shopping cart using ASP Classic(based on a 'WebThang'
> tutorial). The shop cart page (with table showing customers selected items
> and costs) has only 3 buttons/links.
>
> 1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.
>
> 2: Remove Item(one next to each item in cart): Clears the selected item
> from
> the session variable array redisplays the page.
>
> 3: Checkout: Proceeds nicely to the pages that collect the customers
> details.
>
> My Problem:
>
> If the user clicks the 'Remove Item' link/button, the page efficiently
> redisplays with the selected item removed from the list. However, if the
> user then clicks either the 'Back to Shop' button or the browser Back
> button
> (intending to continue shopping), the cart page redisplays showing the
> removed item back in the list as it was before they removed it. Although
> the
> session variable array remains correctly unaltered it is very confusing to
> the user and will probably cause them to feel that their shopping list has
> been 'messed up' and is now invalid.
>
> I understand that the browser is just 'doing what it is told' but need to
> find a way to avoid this confusing behaviour.


If you use location.replace to navigate between pages, the old page gets
replaced in the history stack with the new page, giving you somewhat of an
opportunity to manage what's available to go back to.

-Mark



> Any ideas,
>
> Regards
>
> Penny.
>
>



 
Reply With Quote
 
 
 
 
Penny
Guest
Posts: n/a
 
      05-25-2005
Hi Mark,

Do you have any snippets of code I could see to get a perspective on how
location.replace can be used?

Regards

Penny.


"Mark J. McGinty" <> wrote in message
news:...
>
> If you use location.replace to navigate between pages, the old page gets
> replaced in the history stack with the new page, giving you somewhat of an
> opportunity to manage what's available to go back to.
>
> -Mark



 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      05-25-2005
If you don't want the user be able to see previous pages (exactly as they
were previously) you could likely prevent caching :
http://support.microsoft.com/kb/234067/en-us

Let us know if it works...

Patrice

--

"Penny" <> a écrit dans le message de
news:...
> Hi all,
>
> I've built an online shopping cart using ASP Classic(based on a 'WebThang'
> tutorial). The shop cart page (with table showing customers selected items
> and costs) has only 3 buttons/links.
>
> 1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.
>
> 2: Remove Item(one next to each item in cart): Clears the selected item

from
> the session variable array redisplays the page.
>
> 3: Checkout: Proceeds nicely to the pages that collect the customers
> details.
>
> My Problem:
>
> If the user clicks the 'Remove Item' link/button, the page efficiently
> redisplays with the selected item removed from the list. However, if the
> user then clicks either the 'Back to Shop' button or the browser Back

button
> (intending to continue shopping), the cart page redisplays showing the
> removed item back in the list as it was before they removed it. Although

the
> session variable array remains correctly unaltered it is very confusing to
> the user and will probably cause them to feel that their shopping list has
> been 'messed up' and is now invalid.
>
> I understand that the browser is just 'doing what it is told' but need to
> find a way to avoid this confusing behaviour.
>
> Any ideas,
>
> Regards
>
> Penny.
>
>



 
Reply With Quote
 
Jeff Cochran
Guest
Posts: n/a
 
      05-25-2005
On Wed, 25 May 2005 19:49:08 +0800, "Penny" <>
wrote:

>Do you have any snippets of code I could see to get a perspective on how
>location.replace can be used?


It's a client-side Javascript so you may want to ask in a Javascript
group, but here's a reference page:

http://www.klaban.torun.pl/help/jsref/location.htm

Jeff


>
>"Mark J. McGinty" <> wrote in message
>news:...
>>
>> If you use location.replace to navigate between pages, the old page gets
>> replaced in the history stack with the new page, giving you somewhat of an
>> opportunity to manage what's available to go back to.
>>
>> -Mark

>


 
Reply With Quote
 
Jeff Cochran
Guest
Posts: n/a
 
      05-25-2005
On Wed, 25 May 2005 11:46:49 +0800, "Penny" <>
wrote:

>Hi all,
>
>I've built an online shopping cart using ASP Classic(based on a 'WebThang'
>tutorial). The shop cart page (with table showing customers selected items
>and costs) has only 3 buttons/links.
>
>1: Back to Shop: Uses 'javascript:history.go(-1)' to go to previous page.
>
>2: Remove Item(one next to each item in cart): Clears the selected item from
>the session variable array redisplays the page.
>
>3: Checkout: Proceeds nicely to the pages that collect the customers
>details.
>
>My Problem:
>
>If the user clicks the 'Remove Item' link/button, the page efficiently
>redisplays with the selected item removed from the list. However, if the
>user then clicks either the 'Back to Shop' button or the browser Back button
>(intending to continue shopping), the cart page redisplays showing the
>removed item back in the list as it was before they removed it. Although the
>session variable array remains correctly unaltered it is very confusing to
>the user and will probably cause them to feel that their shopping list has
>been 'messed up' and is now invalid.
>
>I understand that the browser is just 'doing what it is told' but need to
>find a way to avoid this confusing behaviour.


I would think if you coded the shopping cart page to read the session
variables to populate the fileds and prevented caching on the page you
would see the result you want. Perhaps using a pragma:nocache header
would do it, you can use a meta tag for this:

<meta http-equiv="pragma" content="nocache">

There are other ways to disable page caching as well.

Jeff
 
Reply With Quote
 
Penny
Guest
Posts: n/a
 
      05-25-2005
Patrice,

It works in that it prevents previously removed items from the cart being
shown again but when expecting to be redirected back to the last 'shopping'
page it usually says 'Warning: Page has Expired'.

The suggested code:

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

Seems to prevent redirecting to whatever the previous page was. My catch is
that I want to return to the 'shop' page that directed to the 'cart' page in
the first place but not return to an old version of the 'cart' page itself.


 
Reply With Quote
 
Penny
Guest
Posts: n/a
 
      05-25-2005

Thanks Jeff,

I'll have a play with that and get back to you.


 
Reply With Quote
 
Penny
Guest
Posts: n/a
 
      05-26-2005
Jeff,

<meta http-equiv="pragma" content="nocache"> doesn't work either. It still
allows the page to redirect to the previous version of itself.

Penny.

>
> I would think if you coded the shopping cart page to read the session
> variables to populate the fileds and prevented caching on the page you
> would see the result you want. Perhaps using a pragma:nocache header
> would do it, you can use a meta tag for this:
>
> <meta http-equiv="pragma" content="nocache">
>
> There are other ways to disable page caching as well.
>
> Jeff



 
Reply With Quote
 
Adrienne
Guest
Posts: n/a
 
      05-26-2005
Gazing into my crystal ball I observed "Penny" <>
writing in news::

>
>>
>> I would think if you coded the shopping cart page to read the session
>> variables to populate the fileds and prevented caching on the page you
>> would see the result you want. Perhaps using a pragma:nocache header
>> would do it, you can use a meta tag for this:
>>
>> <meta http-equiv="pragma" content="nocache">
>>
>> There are other ways to disable page caching as well.
>>

> Jeff,
>
><meta http-equiv="pragma" content="nocache"> doesn't work either. It still
> allows the page to redirect to the previous version of itself.
>
> Penny.



IIRC the Meta element is controled by the browser and the browser can
disregard it. AFAIK you have to do it server side, eg:
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shopping cart ASP.NET semut ASP .Net 1 05-30-2006 03:46 PM
shopping cart recommendations with asp.net 2.0 alex sparsky ASP .Net 3 01-05-2006 06:10 PM
cookieless asp.net shopping cart code/how to =?Utf-8?B?ZGhucml2ZXJzaWRl?= ASP .Net 0 08-14-2005 07:57 PM
Only First Shopping Cart Item Displays Sparky Arbuckle ASP .Net 0 02-20-2005 09:40 PM
Shopsmart ASP FREE Shopping Cart Boomer Computer Support 0 12-03-2003 06:14 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57