Web Design and Development Forums

cookies for eshop basket

This is a discussion on "cookies for eshop basket" within the ASP.NET Forum section. This forum, and the thread "cookies for eshop basket are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > ASP.NET Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Dec 6th, 2007, 14:27   #1 (permalink)
Up'n'Coming Member
 
Join Date: Sep 2005
Location: athens
Age: 25
Posts: 59
cookies for eshop basket

Hello!
I want to create an eshop basket page for my website.
In the page of each product there is a button which when I press sets a cookie with the value of the respective product_id, using the following code:
<asp:Button ID="btbasket" runat="server" Text="Buy this product" />

In the code behind file, I have the following:


Protected Sub insert_cookie(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles btbasket.Click
Dim MyCookie As New HttpCookie("eshopCookie")
MyCookie.Value = MyCookie.Value & product_code
Response.Cookies.Add(MyCookie)
MyCookie.Expires = DateTime.Now.AddHours(12)
End Sub
Then, when the user wants to see all the things he/she has ordered, they visit the Basket.aspx page,
which has this:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim colCookies As New ArrayList()
For i As Integer = 0 To Request.Cookies.Count - 1
colCookies.Add(Request.Cookies(i))
Next

grdCookies.DataSource = colCookies
grdCookies.DataBind()
End Sub

and, in the .aspx file,
<asp:GridView
id="grdCookies"
Runat="server"/>



But my problem is that the gridview only shows 1 product_id, and, in particular, tha last product the user has selected a he browses the list of the available products...
Is there something else I must do to store all selected product_ids in the cookie and then retrieve them in Basket.aspx page? Must I use different cookie each time?
Thank you for your time...
ktsirig is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] cookies... please help!!!! earl080688 PHP Forum 4 Jan 14th, 2008 05:51
cookies in PHP marquey PHP Forum 4 May 31st, 2007 17:17
how to store cookies selphie08 Flash & Multimedia Forum 3 Sep 20th, 2006 01:54
ASP Cookies señorbadger ASP Forum 6 Nov 22nd, 2003 14:04
Flash+cookies icthecat Flash & Multimedia Forum 1 Oct 31st, 2003 06:32



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 13:53.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


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 58 59