.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Shopping cart session

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :ASP.Net
I am currently developing a shopping cart application. When a user adds a product to their shopping cart, I want their cart to be remembered for at least 3 hours or even more. I also want their cart to be remembered if they close/re-open their browser. If there is an update to the website (e.g. web.config changed) the cart needs to be remembered.I am thinking of using SQL server to store the sessions. Is this the best way for this scenario? Also how do I keep the session alive if users close their browser?

View Complete Post

More Related Resource Links

using Session variables in shopping cart module.



     Can anybody explain me how can i use session variables in shopping cart module.There are many products from which the user can choose from.

I jus did small part of this module, On clickning Add To Cart Button, that product details will be bounded to datatable which will then be redirected to shopping cart page to display it in gridview. This is for only one product. (single product details (1 row) will be shown on this gridview)


Now my query is how do I Add Multiple products on clicking add to cart on some other products page retaining the previous product in gridview.


Also I would like to know how to manage different customers (username) in Shopping cart module.


Thank u in advance.


JQuery Shopping Cart


Hi everyone,

I am looking for the Shoppincg Cart code in JQuery.

If you know the URL(s), then please let me know.



Where to store Shopping Cart in MVC Application?


I am working on a Railway Portal and would require maintaining a shopping cart of components user has selected, there could be multiple components of different type in the cart. I don't see a value in storing the cart in database, would like to store the final order in DB. Where can I store/hold (temporary) the cart data per user session in MVC? All MVC samples I saw online save the cart data in DB - not sure why.

MVC presentation layer will be communicating with external web services for pricing and availability of these components, so I can't store only the product IDs to do a lookup for actual product descriptions/prices during the shopping process... I have to store everything in the cart (Product IDs, Descriptions, Prices etc) some place in memory.  My application will be running in WEB FARM environment and cannot use in-process session storage.

Options come to my mind are:


2. Using some kind of Distributed Caching Mechanism to store Session data such as "Windows Server AppFabric"


Shopping cart question


Helo Everyone.......

Actually i m now working on shopping cart application.....

i m using datalist control on my main page where i m displaying my products .....nd when i click one of  these products....i redirect to second page where all the information regarding the product is displayed.......

nd when i wanna purchase other product from mine main page nd i come back ....than information regarding all selected product lost which i already did selected for purchase.......

nd i m using gridview control for displaying information regarding the products on secongd page........

so share  ur valuable help me to come out from this problem that......how i have need to maintain the state of second page............

i think it's possible with session control......but how can we use......??

i m using asp.net with c# track.........

shopping cart update qty



im new in mvc and i am trying to do a shopping cart, but i was following the mvcstoresample, it is really nice, but it doesnt have quantities, and i wanna update that functionality, but in the shopping cart view i have a table populated via ajax, now i wanna have and update cart button and a textbox for the quantity, and when i click on update button i wanna update the subtotal by item and the total amount, how can i do that with ajax?


Advice for web app and shopping cart


 I need a web app the can do something similar to this: http://www.printmyribbon.com/design/ribbon/no/906

The app on this site is a flash app. Can a similar app be created with asp.net or silverlight perhaps?

I am going to be designing a site soon and also need to implement a shopping cart. What is the standard way of storing items in a shoppping cart for an asp.net app. Im playing with the idea of storing the items in a dataTable within a session variable.

Any imput on either of these questions would be greatly appreciated.


Shopping cart query


I am working on building a new shopping cart applicaiton. When i checked many shopping card applications, i found that the cateogry pages and product pages seems to be dynamically created. eg: http://shopping.sify.com/cadbury-bournville-almond/chocolates/CHOC24112009TTL14.htm

How this is being done? Is this page is created while adding product itself?

Shopping cart project for school


Win 7 professional N

Microsoft visual studio (student edition) 3.5 frame work

language: C#

SQL Express Server for the database.

Status of the application: Working, but the user can only checkout with 1 product.

My question:

I am building a very simple shopping cart website for a school project. After the user selects the item(s) and and quantity. What would be a better option to display what they ordered other than pulling the "order details" into a list box? I can only have the user select one item to check out with...   I've tried google for some examples but they all are showing examples of a listbox... Below is a rundow of my application.


It grabs the products from a database (ID, Name, Description, Price, ImgPath) and display the name of the product & the ID for the Value of the ddl in a drop down list . The order page will display : the name of the product, the description, the price, and a picture of the product. Their also is a drop down list for the quantity ( how many you want of a particular product ).

Once the user selects a product and how many he/she wants, that information is then transfered to a listbox on "checkout1.aspx".


The listbox (

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

SQL Server Session state problem.


Hi to all,

I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.

Session and Application Variables


I have a web application in which i need to logout the user if he clicks the logout button or even if he closes his browser window. On Logout button click, i am doing session.Abandon(), but how to go about his browser window close.

Can anybody help with a code sample.

Is there any way to find out the reason for session expiry?


Dear All,

is there any way to find out the reason for session expiry?



Session time out earlyer with in 5 min.


In my live site session time out with in 5 min only.how can i get the default i.e 20 min time . below webconfig file give below

<?xml version="1.0"?>
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, &#xA;        System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, &#xA;        PublicKeyToken=31bf3856ad364e35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, &#xA;        System.Web.Extensions, Ver

Datatable in session


I am creating a simple shopping cart using a datatable that is passed into a session object.  I have a small mini cart that displays the total number of items in the cart as well as the running total - this is displayed in a web control.  When the web control starts up I run a try/catch to see if the session object exists, if it doesn't I create the datatable for the cart and store it in the session.  I then have a datalist control that contains all the information for my products including an "add to cart" button.  When the page loads everything looks fine.  If I click on an "add to cart" button nothing happens to the session information.  If I click on it again, the session information updates - displaying only one item is in the cart and then counts up correctly there after.  Additionally, after adding an item, if I select a different item in the list, the same issue occurs.  I am not sure why this is happeing, if anyone can give me an idea I would appreciate it. 



Hi friends

I m facing a problem in my application with server so it needs changes .

My question is

Q1.Where should I store my session if i want to disconnect my server or How shold we storesession in web farm if specific serever is shut down.

Q2.Can anyone explain me difference between WEB FARM and WEB GARDEN






Session Timeouts


What are the issues (if any) of setting sessions to expire after an extended period of time as in 4-8 hours? I'm building an intranet app which is designed so that users will access it once in the morning and then leave it used, possibly, for hours at a time. I'm assuming that there aren't too many since

1) we're running it on a intranet
2) sessions are soley to retain state between requests
3) its not like a connection to the DB where you can conceivable run out

holding datatable value using session



iam insert record using datable in gridivew,iam using  session to hold the record,

there is any other way to hold the record in datable.


        DataRow row;
        row = dtempty.NewRow();
        row["ratetypeid"] = ddlratetype.SelectedValue;
        row["ratedesc"] = ddlratetype.SelectedItem.Text;
        row["slabs"] = ddlslabs.SelectedValue;   

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend