Solved

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

Posted on 2009-04-09
4
270 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
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
Buginator earned 500 total points
Comment Utility
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
Comment Utility
Thank you for your opinion Buginator. Its much appreciated.

Kind Regards,

Rit
0
 
LVL 21

Expert Comment

by:Craig Wagner
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now