Solved

session id / anonymous id to save shopping cart

Posted on 2010-11-09
5
892 Views
Last Modified: 2012-06-27
I want to be able to save the shoppping cart even whether the user is logged in to the website or not. how can I associate the shopping cart to the user when the user is not logged in.

If I use the session ID can I still acess the same session ID, even if the user closes there browser and re-opens after a few days?

Should I be using the anonymous ID for this purpose instead of session ID. Thank
0
Comment
Question by:TrialUser
  • 2
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 167 total points
ID: 34093025
I would use something like the client's IP address to use as the "anonymous ID" for the user.  You can get it with this:

HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

Then, save this out in a Cookie.  Sessions won't last but Cookies will.

0
 
LVL 18

Assisted Solution

by:Richard Lee
Richard Lee earned 333 total points
ID: 34094018
Simply save the shopping cart details in a cookie if the user is not logged in and to make the user really happy, merge the contents of the cookie with their existing basket contents after offering them the option.

DaTribe
0
 

Assisted Solution

by:TrialUser
TrialUser earned 0 total points
ID: 34094259
Ok, instead of writin g to a cookie can I write into the database? I am wondering if we can loose the information stored in the cookie based on the users browser settings. Thanks
0
 
LVL 18

Assisted Solution

by:Richard Lee
Richard Lee earned 333 total points
ID: 34094370
No doubt you can lose the information in a cookie based on the user settings and also if they love clearing their cookies. The database would be a great solution - like what amazon does.

DaTribe
0
 

Author Closing Comment

by:TrialUser
ID: 34143320
thx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 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

20 Experts available now in Live!

Get 1:1 Help Now