Basket Question

S

Samuel Shulman

I want to allow customer to 'Add to Basket' even if they are not logged.
Once they log the content of the basket will be saved for the future

Next time they may add other items to the basket before they log and then
they may log

What is expected at that point?

Merge the content of the baskets delete the old one or else

Thank you for your advice,
Samuel
 
M

Marina Levit [MVP]

I haven't seen site that work both ways.

Either you can always add things to the basket, and the basket does not get
saved between sessions or between PC's or whatever. Or, when you try to put
something in the basket you get prompted to log in so the contents of the
basket can be saved on the server. I don't think I've seen both models.
 
K

Ken Cox [Microsoft MVP]

Hi Samuel,

You can do exactly this with ASP.NET 2.0 using Anonymous Profiles and
Membership. Use anonymous profiles while the user is browsing and adding to
the basket and then migrate the contents once they log in.

More Here:

http://www.ondotnet.com/pub/a/dotnet/2004/08/16/whidbey_personalization.html?page=last

and here

http://msdn2.microsoft.com/en-us/library/ewfkf772.aspx


Ken
Microsoft MVP [ASP.NET]



Migrating Anonymous Profile Information

In some cases, your application might initially be maintaining
personalization information for an anonymous user, but eventually the user
logs in to your application. In that case, the user's identity changes from
the assigned anonymous user identity to the identity provided by the
authentication process.

When users log in (that is, when they stop being anonymous users), the
MigrateAnonymous event is raised. You can handle this event to migrate
information from the user's anonymous identity to the new authenticated
identity, if necessary. The following code example shows how to migrate
information when a user is authenticated.

Visual Basic Copy CodePublic Sub Profile_OnMigrateAnonymous(sender As
Object, args As ProfileMigrateEventArgs)
Dim anonymousProfile As ProfileCommon =
Profile.GetProfile(args.AnonymousID)

Profile.ZipCode = anonymousProfile.ZipCode
Profile.CityAndState = anonymousProfile.CityAndState
Profile.StockSymbols = anonymousProfile.StockSymbols

''''''''
' Delete the anonymous profile. If the anonymous ID is not
' needed in the rest of the site, remove the anonymous cookie.

ProfileManager.DeleteProfile(args.AnonymousID)
AnonymousIdentificationModule.ClearAnonymousIdentifier()

' Delete the user row that was created for the anonymous user.
Membership.DeleteUser(args.AnonymousID, True)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top