Last post Jun 22, 2011 04:48 AM by Mamba Dai - MSFT
Jun 17, 2011 01:47 PM|Axiomsw|LINK
I am not certain if the problem is the use of Session Variables, but I am definitely using them.
We have a site that has a shopping cart. The contents of the cart are stored in a System.Data.DataTable and this is written to a session variable. When an item is added to the "cart" the data displays fine and all looks great. But the data stored in the
session variable is doubled. I used a loop to check the records in the table before saving to the variable, and then again after reading the data back into a new table from the variable and the qty seems to double. This only happens the first time an item
To make it worse, the error does not happen if the browser being used is IE7, IE8 or Opera 11, but it does occur on all other browsers I've tried (Safari 5, Firefox 4, Chrome, IE9).
Jun 18, 2011 04:54 AM|GPankaj|LINK
Are you trying to store static or shared data into the session variable. This must be the cause of data double.
Can you please post the code?
Jun 22, 2011 04:48 AM|Mamba Dai - MSFT|LINK
Based on above information, you save the data into a Session variable. Now you add an item into the data, and then save the data into the Session variable. If you do what like this:
The Session variable is doubled, and you need to change the "+=" to "=".
If the above solution does not work, I think you need to provide your source code so that we can reproduce your issue and then solve it. You can remove any confidential information or business logic from it, just need a simplest sample.