Solved

Efficient Method to Show User's Last Viewed Catalog Items Function

Posted on 2009-04-09
4
318 Views
Last Modified: 2012-05-06
Hi All,

I am looking to develop a shopping cart and I would like to include a user function which will show the user's last 2 product items viewed.

I am creating the cart using ASP.NET and SQL Server...

What would be an effective/lightweight way of storing this user specific information?

Would it be to write the product IDs to a cookie and call upon that cookie each time the page is loaded?

If anyone has implemented a similar function I would be very interested on how you achieved this.

Thanks,

Rit
0
Comment
Question by:rito1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
Buginator earned 500 total points
ID: 24107644
Hi rito1,

For long term tracking, use cookies. This way the user can see this list a week after last visit.
For short term tracking, use sessions. In either case, remember to always check for null, otherwise nasty errors will show.

Both is lightweight if properly dealt with.

Since you are dealing with products that in theory could be deleted or edited after the user last visit, I would have saved the products ID as a CSV in the session/cookie. Then you lookup these products from the ID's, when you want to show the last visited product list. By doing this you avoid that the user visit your site, and click on a recently visited product, which has been deleted, and the user get an error.

By retrieving the products from the CSV, you end up with using a little bit more resources, but you also get up to date information about the product name, price, image, information and even if it still exist. The performance issue should not be a problem here, unless you have an extremely populated server. Even if that's the case, I would still use the above method, storing the product ID's in a CSV to avoid errors and confusion.

Let me know if there is anything else you wonder about.
0
 
LVL 1

Author Comment

by:rito1
ID: 24107679
Thank you for your opinion Buginator. Its much appreciated.

Kind Regards,

Rit
0
 
LVL 21

Expert Comment

by:Craig Wagner
ID: 24107724
If you want simple and lightweight, the cookie approach is probably your best bet.

If you wanted it to work in cases where the cookie was not enabled, you could use server-side session state to store the information. Out of the box ASP.NET uses in-process session state, so it's pretty fast to store and retrieve session information. The downside to this approach is that if the web server goes down you lose the session state, it's not persisted across sessions (e.g. if you wanted to show the information three days later when the user visits again), and if you're running in a web farm you'll either need to use sticky connections (so the user's session always returns to the same web server) or go with a central state server (e.g. the built-in state server), which will increase the complexity of deployment a tiny bit.
0
 
LVL 1

Author Comment

by:rito1
ID: 24107812
Thanks CraigWagner,

I like the idea of the user being able to return to the site a few days later and it store their last viewed info (providing their cookie remains).

Thanks Both,

Rit
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question