I have a situation where we want users to chekout anonymously. And be able to use the same account if they wish to checkout second time using same email address.
So I need to create a CustomerContact Object. And be able to access this object on any page and persist user session if they go back and forth on any page.
For this I need the contact object in CustomerContext.Current.CustomerContact.
My work around for this is, I am creating a contact object with only email address and then creating the formsauthentication cokiee for this customer. Now I get the value in CustomerContext.Current.CustomerContact.
Problem: This all works fine for checkout. But the problem is the user is now treated as logged in user. And he can access the restricted pages which are allowed only for registered users.
Has anyone come across this situation and found any better way to do this?
If a customer wish to check out anonymously, shouldn't we forget everything about them after the order placed? If they don't mind to input their information then they won't mind a second time.
But if it is a must, then I guess you can create a new role (AutoRegistered, for example), to separate it from the Registered role, and allow access only to Registered role.
Gotcha! I ll try this. Yes we can forget them after they place the order but we need to keep them if they go back and forth between pages for current session.
If you only want to store the information for a single session, store everything in the cart instead. The cart has addresses, email and can be extended to have more fields if necessary. That way you don't end up creating a lot of extra customer contacts. If they buy something the cart and everything in it will be converted to a purchase order so the information is only lost if the decide to leave the site and close the browser (or time out their session).