473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

help pls.. easy question??

i just finished creating an asp.net application named teddybears.

during the testing phase uploaded live ( ex: www.teddy.com) , i tried to
purchase something and add it to my shopping cart.

then, i tried opening the application on a different client computer. I just
randomly checked the shopping cart and there i found the same items i added
to my cart on the first computer.

all i did using to add to my cart was session("cart").

how can i just save the contents of the current cart to the current machine
being used?

thanks a million guys!
Jan 28 '07 #1
10 1132
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
how can i just save the contents of the current cart to the current
machine
being used?
How are you adding cart data to the Session object...? Sounds very much like
you're using static variables...
Jan 28 '07 #2
hey Mark

Session("cart") is an array of prodID,desc,qty and amount.

I add an item by adding the prodID to the BearArray() and re assigning that
array to the Session("cart") variable. These all revolves in a class called
shoppingcart.vb

Is there something wrong with what im doin?

"Mark Rae" wrote:
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
how can i just save the contents of the current cart to the current
machine
being used?

How are you adding cart data to the Session object...? Sounds very much like
you're using static variables...
Jan 28 '07 #3
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
Session("cart") is an array of prodID,desc,qty and amount.
No doubt, but how / where is it declared...?
I add an item by adding the prodID to the BearArray() and re assigning
that
array to the Session("cart") variable. These all revolves in a class
called
shoppingcart.vb

Is there something wrong with what im doin?
Impossible to tell until you actually show us your code...
Jan 28 '07 #4
Hi Mark,

here's the piece of the code:
---------------------------------------
on my cart.aspx page:
---------------------------------------

Dim ala As New ShoppingCart

If Not IsNothing(Session("shoppingcart")) Then
ala = Session("shoppingcart")
End If

Dim objCartItem As New cartitem
Dim intItems As Integer

objCartItem.itemcode = seqid
objCartItem.itemname = seqname
objCartItem.qty = Qty
objCartItem.ddate = eventDate
objCartItem.unitprice = unit
objCartItem.total = objCartItem.unitprice * objCartItem.qty

ala.addCartItem(objCartItem)
Session("cartcount") = ala.CountItemsinCart.ToString
Session("shoppingcart") = ala

----------------------------------------------------------
on Global.vb class:
----------------------------------------------------------
Public _ItemsinCart As New Collections.ArrayList

----------------------------------------------------------
on a separate class called ShoppingCart.vb :
----------------------------------------------------------
Public Structure cartitem

Public itemcode As String
Public itemname As String
Public ddate As DateTime
Public unitprice As Decimal
Public total As Decimal
Public coupon As String
Public grandtotal As Decimal
Public qty As Long
Public schedulecode As String
End Structure

Public Sub addCartItem(ByVal item As cartitem)
If Not isItemExists(item) Then
_ItemsinCart.Add(item)
End If
End Sub

Everything seems to be fine except when i try to open another browser on
another computer i get the same shopping cart items from the first computer.
Does this have something to do with in process or out process memory thing?

thanks
"Mark Rae" wrote:
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
Session("cart") is an array of prodID,desc,qty and amount.

No doubt, but how / where is it declared...?
I add an item by adding the prodID to the BearArray() and re assigning
that
array to the Session("cart") variable. These all revolves in a class
called
shoppingcart.vb

Is there something wrong with what im doin?

Impossible to tell until you actually show us your code...
Jan 29 '07 #5
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
Public _ItemsinCart As New Collections.ArrayList
There's your problem - that ArrayList will be shared by the entire
application. Create your ArrayList in Session_Start, and don't make it
Public.
Jan 29 '07 #6
Thanks Mark! i'll try this

but i read the other post one before this, so thanks again!

"Mark Rae" wrote:
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
Public _ItemsinCart As New Collections.ArrayList

There's your problem - that ArrayList will be shared by the entire
application. Create your ArrayList in Session_Start, and don't make it
Public.
Jan 29 '07 #7
Hi again,

im having some problems in putting the arraylist at session_start in
global.asx,

so how do u exactly write it?
it doesnt recognize it if i write somethin like:
------------------------------------
Private _ItemsinCart As New Collections.ArrayList.ArrayList
------------------------------------

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
'Private _ItemsinCart As New Collections.ArrayList.ArrayList
Session("_ItemsinCart") = ""
Session("_CustomerInfo") = ""
Session("_BillingInfo") = ""
Session("_CreditCardInfo") = ""
End Sub

Thanks

"ChiWhiteSox" wrote:
Thanks Mark! i'll try this

but i read the other post one before this, so thanks again!

"Mark Rae" wrote:
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
Public _ItemsinCart As New Collections.ArrayList
There's your problem - that ArrayList will be shared by the entire
application. Create your ArrayList in Session_Start, and don't make it
Public.

Jan 30 '07 #8
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.com...
it doesnt recognize it if i write somethin like:

Private _ItemsinCart As New Collections.ArrayList.ArrayList
There's no point at all saying something like "it doesn't recognise it", or
"it doesn't work" or "it throws an error" unless you actually say why it
doesn't recognise it, what error you get etc...

so how do u exactly write it?
Not exactly sure, as I never go anywhere near VB.NET, but it's probably
something like:

Private _ItemsinCart As New System.Collections.ArrayList()
Jan 30 '07 #9
It actually says "Private is not valid on a local variable declaration"

any ideas ?

Thx!!

Private _ItemsinCart As New Collections.ArrayList.ArrayList

There's no point at all saying something like "it doesn't recognise it", or
"it doesn't work" or "it throws an error" unless you actually say why it
doesn't recognise it, what error you get etc...

so how do u exactly write it?

Not exactly sure, as I never go anywhere near VB.NET, but it's probably
something like:

Private _ItemsinCart As New System.Collections.ArrayList()
Jan 30 '07 #10
"ChiWhiteSox" <Ch*********@discussions.microsoft.comwrote in message
news:9D**********************************@microsof t.com...
It actually says "Private is not valid on a local variable declaration"
I just created a new VB.NET website, added a Global application class,
pasted your code, and let IntelliSense find and correct the error for me -
didn't you have that option...?

Anyway, change Private to Dim
Jan 30 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Will | last post by:
(My 4 questins at end after explination) The code below was provided to me to "Popup" a window explaining what a Credit Card Verification Number is and where to find it on a card... it is used as...
12
by: Vibhajha | last post by:
Hi friends, My sister is in great problem , she has this exam of C++ and she is stuck up with some questions, if friends like this group provides some help to her, she will be very grateful....
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
2
by: Will | last post by:
(My 4 questins at end after explination) The code below was provided to me to "Popup" a window explaining what a Credit Card Verification Number is and where to find it on a card... it is used as...
4
by: Steve Klett | last post by:
(I posted this in ADO group, but I think this group will be better) Hi- I need to develop an FAQ section for our website. We would like to break up the FAQ by products, then categories with...
8
by: John | last post by:
Is there any special code I have to write to log event to Security Event Log? The following code give me "Very Easy Question, How to write log to SECURTY Event Log? Please help" Error // Create...
19
by: ash | last post by:
hi friends, i have some questions whch is in my last year question papers.i need some help to get logic of these questions. 1) write a C function, that takes two strings as arguments and...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
3
by: standon410 | last post by:
Hi, I'm trying to develop a questionnaire...basically a user can pick one of 5 questionnaires they want to use, and based on their choice, those questions will appear in their form. So the...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.