.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

Where to store Shopping Cart in MVC Application?

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

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"


View Complete Post

More Related Resource Links

Shopping cart session

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?

How to Programatically SetCredentials for Secure Store Service Application in Sharepoint 2010 using

I have to setup Credentials for Secure Store Service application programatically. To get Stored Credentials I have following code and its working fine. using (SPSite site = new SPSite("http://vtlssp2010Dev")) //using (SPSite site = new SPSite("http://" + System.Environment.MachineName + "/sites/Site_Name"))d { Console.WriteLine(site.RootWeb.CurrentUser.Name); SPServiceContext context = SPServiceContext.GetContext(site); prov.Context = context; try { SecureStoreCredentialCollection cc = prov.GetCredentials(appID); foreach (SecureStoreCredential c in cc) { IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(c.Credential); string sDecrypString = System.Runtime.InteropServices.Marshal.PtrToStringUni(ptr); Console.WriteLine(sDecrypString); } } catch (Exception ex) { Console.WriteLine("Unable to get credentials for application " + appID); Console.WriteLine(ex.Message); } Console.ReadLine(); } } All I want is to programmatically do set credentials like explained in this example on msdn. http://msdn.microsoft.com/en-us/library/ff798456.aspx Please help. Shamshad Ali  

Secure Service Store and custom web application.

 Hello All,  I have a problem for which I would like to use the Secure Service Store.  I've searched for similar solutions involving the SSS but I've not had any success yet.  Maybe I'm missing something obvious or going about it the wrong way.   We have an external application (actually, a number of external applications) we'd like to embed in our SharePoint site using an iframe or the Page Viewer web part.  The embedded application uses a custom forms based authentication scheme and I want to prevent the situation where a user has to log into our application then log into the embedded application.  Is there anything available the help post the credentials from SSS to the custom application?  The only think I can think to do is write some code that mimics a post to the login page of the embedded app and, if needed, write a stripped down or simpler login page for the embedded app to make that easier.  For my immediate task I have quite a bit of control over the source of both application and could write custom code on both sides if I had to, but I'd rather have a solution that only involve configuration or, at most, custom code on the SharePoint side.  Thanks,  Brandon 

The Best Place to store Settings for Web Application.

I want to create an Application Setting or Control Value for "Application Run Mode", which will indicate if the application is in Testing Mode or Live Mode. So I have created this Enum Type: Public Enum AppRunModeType Live Testing End Enum and, this will be used inside the the Web Application to determine if the application run mode, and hide/show some UI Controls accordingly. This Setting "Application Run Mode" is not a User Setting, it is a setting to be controlled by the developer who is deploying the application. Where is the best place to store this value ? I am thinking there are 2 places: 1. In web.config "appSettings" secting, 2. Or in Project Properties Page/Settings Section. If I choose to store it in web.config, then, I will not be able to have Strong Type Access to the value like the Enum type, and I have to convert from Enum Type to String and vise versa. If I choose to store it in Project Properties Page/Settings Section, then I cannot do that, becuase my Web Application is not a Porject and I cannot find this page there, or I will have to convert the Web Application to a Web Application Porject, and this is a Long Story. Also, How I can access My.Settings object from the Web Application ? Appreciate if some one could point me to the right direction and the best way to hanlde such requirement.

Create a new target application - Secure Store Service administration issues

Hi,I am trying to create new target application, when I go to Secure Store Service in Centra admin I have:Cannot complete this action as the Secure Store Shared Service is not responding. Please contact your administrator.I have used this few days ago and avarything else is working fine on the server, and I have applications created with it running fine.Any help is appreciated.cheersValko

Store lists for an application different dropdownboxes?

Hi prosI have until now always stored my lists definitions for labels and values for dropdownboxes in my own defined Xml files. These lists labels I then match with a language file (.resx) ..... so far so good but now I am starting a new project. Should I continue with my old habbits or is there a better way of storing label constants for my dropdown boxes throughout my application?I would be happy skipping my read and write rutines for my onw structure if there is a better dedicated one for the purpose.Mr Virtual Office guy

What's the best way to store Data from DataBase like XmlNode... Application vs Cache


 Hello, i am building an N-tier application now i want to store Data(like XmlNode) that is common to all users ..

now i thought using Application to hold the data but my data lays in the BLL tier which is an Class Library project and i can't store any datain there for example :

HttpApplication MyApp=new HttpApplication();



My question is what is the best way to store Data (not small data like user name etc..) is it Application? orCache?

i would like a small example within a ClassLibrary project...


Unable to set up a new Secure Store Service Application in a single-server installation


Problem: after initial SharePoint installation, I tried to add the Secure Store Service Application under "Manager Services Applications".  The process screen returns something like "The time job created.  But failed to start in one or more servers in the farm."  Further investigation found that in the SQL Server, the secure service account was not added under the Login user accounts.  The Secure_Store_Service_DB has been created, but not under the name of secure store service account.  In another word, the database was created but the action seems to be incomplete.

Background: this is a single server farm installation on Windows Server 2008 R2, SQL Server 2008 R2, with AD CS and AD DS, DNS roles enabled on the same box.  The configuration task was running with the farm admin account which is also a domain admin, and has dbcreator, securityadmin, and sysadmin roles in the SQL server.


How and Where to store search parameters in MVC application


I am working on a railway web application and I have following layers:

ASP.NET MVC 2 (Presentation Layer) 
Services Layer 
Repository Layer 
Database & External Web Services as data sources (Using Entity Framework for Database) 

I pass Domain Entity Objects from Repository to Service layer and thinking of passing View Models from Service to Presentation layer. Website would require a login and after successful login I have to present a search screen with basic search (as default option) and option for advance search. Once user fills the search criteria I have to gather data from DB & Web Services and present the results to user. User would select a particular Rail option and would move on to other additional options page BUT they should be al

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.



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.


Best practice to store the shared folder path across the whole application


For example. The folder MEDIA_ROOT must be visible from the whole application, it stores the path of all my media files.

What is the best practice to store such a global variable.

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 (

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.


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