![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 54
Rep Power: 3
![]() |
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... |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Intermittent crunching of the cookies | grumpy | Community Announcements and Feedback | 5 | Nov 5th, 2007 10:04 PM |
| Cookies or Sessions? | Satans_Banjo | PHP | 2 | Jul 9th, 2007 5:25 AM |
| FireFox Turning of cookies | kruptof | Coder's Corner Lounge | 4 | Aug 11th, 2006 9:13 PM |
| Delete local cookies with javascript | Lich | JavaScript and Client-Side Browser Scripting | 9 | Mar 18th, 2006 8:38 AM |
| Cookies | sephers | PHP | 2 | Jun 9th, 2005 11:08 AM |