Sharing cookies
Sharing cookies
Sharing cookies
Sharing cookies
Sharing cookies
Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies
Sharing cookies Sharing cookies
Sharing cookies
Go Back  Xtreme Visual Basic Talk > > > Sharing cookies


Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2007, 11:46 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default Sharing cookies


I don't know if the title or the forum is appropriate. I leave it to the mods.

My question is this;
Right now I am working on an ecommerce site. The site has a shopping cart and it uses cookies to save cart information like the items chosen.

The problem I have is, the cookies are not shared by different browsers. My point is, when I display the shopping cart, it becomes different with each browser.

I was wondering if it is possible to have this information shared.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #2  
Old 08-11-2007, 05:31 PM
MKoslof's Avatar
MKoslofSharing cookies MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Just for clarification,are you saying if you launch a new IE browser instance, they won't share the cookies, or its not persistent or sharing expiration and a new sessionID is created if you visit the same application? Or are you saying the results are different if you use IE and FireFox for example, etc.

If you launch a seperate PROCESS it will not share cookies. You might want to use a hidden field or some other persisting mechanisms in this case.
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown

Last edited by MKoslof; 08-12-2007 at 10:01 AM.
Reply With Quote
  #3  
Old 08-12-2007, 05:28 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

Thanks MKoslof.
I was saying that the cookie items are different per browser. Meaning, an instance of each, Firefox, Safari and IE or any other browser.. will contain a different version of the shopping cart. This, right now, is due to the fact that shoppers can add items to the cart without logging in.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #4  
Old 08-13-2007, 08:17 AM
MKoslof's Avatar
MKoslofSharing cookies MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Why not require a login? Restructuring this sounds like the best plan. Again, each seperate process (Open up a new instance of IE, browse and do something, now open up a new instance of FireFox, browse and do something) will not share cookies. So if this is what you are stuck with, and you have no level of FormsAuthentication or WindowsAuthentication, you are going to have to think of a different way to track this information.
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #5  
Old 08-13-2007, 12:43 PM
MikeJ's Avatar
MikeJSharing cookies MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

The better way to consider this, as MKoslof has suggested, is to store your data differently. Create a basic DB system (which I'm sure you have already) that keeps track of products. Then, create a new table with user account info (this way, they have to log in to add things to a cart), which can contain all relevant information (billing & shipping addresses, credit card info -- if they're willing to let you store it, etc.). Then create a third table that links userid's to productid's in a one-to-many fashion, allowing for a shopping cart to be saved on the server.

You can periodically prune the cart table (ie, "DELETE FROM ShoppingCart WHERE DATEDIFF(ww, lastupdate, NOW()) > 1") to save database space.

Advantage would be sharing of cart info across browsers, but the disadvantage would be a larger DB required.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #6  
Old 08-13-2007, 02:09 PM
PrOpHeT's Avatar
PrOpHeTSharing cookies PrOpHeT is offline
Hopelessly confused...

* Expert *
 
Join Date: Mar 2001
Location: Tyler, Tx.
Posts: 3,055
Default

Couldn't the information be stored in a a session variable, which correct me if I am wrong is not even on the host machine and not browser specific either, as I understand session variables they are stored on the server in the session object, and only use cookies for the purpose of machine/session identification. db maintenance would be moot as information would simply disappear with the session when the user disconnected? You could keep an arraylist of custom structures you create to represent an item in your cart, this would be easy to add and remove from.


Or did I miss something?
__________________
When you earnestly believe you can compensate for a lack of skill by doubling your efforts, there's no end to what you can't do ;)

For the love of Gold...

Last edited by PrOpHeT; 08-13-2007 at 02:15 PM.
Reply With Quote
  #7  
Old 08-13-2007, 03:00 PM
MikeJ's Avatar
MikeJSharing cookies MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Sessions are unique per browser though, if I recall correctly. Still wouldn't be able to access them without some form of log-in system so that you could access an already established session variable on some other browser platform.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #8  
Old 08-13-2007, 04:14 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

Thanks for all the inputs. It's really sad were on different timezones. It would have made discussions quicker.

Yes I know the most feasible way to do this is to require logging in. But I do not work in an IT company. Our goal is to sell products and it's Marketing's call how the flow of the site goes.

As for the DB strategy, having 15thousand shoppers online at any given time and day of the week makes this non-feasible. Also, with no disrespect to Microsoft, their SQL Server's Replication thingie is.. well.. y'know. We haven't quite mastered it?(if that's the proper term) We have a lot of DBServers and a lot more web servers and replication is a nightmare. Right now, our cookies live up to 1 year, yes, that is how long marketing wants the information there.

So I guess my last resort is to explain as clearly as I can that what they want to happen is.. well.. impossible?

Thanks guys. Much appreciated.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #9  
Old 08-13-2007, 04:45 PM
MikeJ's Avatar
MikeJSharing cookies MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Well, there are ways to log in without making it too hard on the user experience. You can still use cookies to show recently viewed items, for example. You could also look into AJAX for seamless login, rather than having to POST to a page and then back again.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #10  
Old 08-13-2007, 05:06 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

Most of the pages uses AJAX. We implemented it for a "richer user experience." Right now, the situation where I need to preserve the contents of the cart browser independent has been overshadowed by other(new) enhancements so I will have more time to research on it.

Hopefully, when we finish the site, I can invite you all (everyone with internet access) to visit and those in the US to buy something. haha!

Thanks all.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #11  
Old 08-13-2007, 06:04 PM
MKoslof's Avatar
MKoslofSharing cookies MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

The fact that you aren't doing any sort of authentication hinders you in this regard.

Typically a shopping cart solution combines database and cookies. For example, after the person logs in, you get the information from the database and write out a cookie, which for example might contain the user id or something of the like.
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #12  
Old 08-13-2007, 06:11 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

Well, to put it figuratively, the site is a store and stores do not filter/authenticate everyone that walks in the door. Basically everyone is welcome to browse and add items to your cart without actually buying anything. The problem is, in stores, when you leave your cart, it is taken care of at the end of the day and the products are put back in the shelves. This does not hold true with our site. Your cart has a life of 360 days or until deleted whichever is longer.

Right now I have modified it enough to recognize older items and merge them with your new cart items upon login. What I want to achieve now is to read the "other" items in cookies created by other browsers.

Thanks MKoslof for staying up late.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #13  
Old 08-13-2007, 06:48 PM
MikeJ's Avatar
MikeJSharing cookies MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

About the only other thing I can think of (which is flaky in of itself) is to read user IP addresses, and then display a cart off of IP addresses. The flaw of course, is users using multiple IP addresses or multiple users using the same IP address. You'll get confusion.

Look at amazon.com. You can put as many items in your cart there as you wish, but if you go into another browser, it's all gone unless you've logged in first to save your cart to the database.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #14  
Old 08-13-2007, 07:33 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

Quote:
Originally Posted by MikeJ View Post
Look at amazon.com. You can put as many items in your cart there as you wish, but if you go into another browser, it's all gone unless you've logged in first to save your cart to the database.
are you sure were not in the same company? Because I swear that is what they told me to prevent.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #15  
Old 08-14-2007, 07:26 AM
MKoslof's Avatar
MKoslofSharing cookies MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Unfortunately I don't see any way around this issue for you. If you want cross browser support, you need a way to persist this information and you will not be able to use cookies.

The Profile provider within the Membership API model of 2.0 would be an attractive choice or any type of database persisting mechanism. Without this, I don't have many other suggestions.
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #16  
Old 08-14-2007, 10:14 AM
MikeJ's Avatar
MikeJSharing cookies MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

If you want something to bring the marketing guys back to earth, you could use the analogy of a store & cart even further. Think of each browser as a different type of shopping cart (for the sake of fun, Firefox is the sleek one, IE is the klunky one whose wheels get stuck often, and Opera is the one with square wheels). You can't replicate things into all the carts without first taking things off of the shelf and sticking it into each of the carts.


Besides, how many people really use multiple browsers regularly?
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #17  
Old 08-14-2007, 04:57 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

MikeJ, your choice of descriptions for each cart just made my day! Thanks. Safari would be what? The one with lots of colors and animations?

Putting that aside, MKoslof's suggestion is another option I am looking at. Am already researching on the implications of saving an encrypted text file on the client machine to serve as MY cookie. Although this early I can already visualize it as a lot of work and almost like an SSL certificate, we here are considering it.

I believe this concept(of persisting a cookie across browsers) came from the sites Wish List feature.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #18  
Old 08-14-2007, 05:53 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

right now I am reading this and will probably send a copy to "them" pointing to item 6. Darn.....
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #19  
Old 08-15-2007, 06:38 AM
shaul_ahuvaSharing cookies shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

You can always handle it like many other sites I've seen - you can add as many items to the cart as you want, but in order to save the cart for future use you must register.

It doesn't answer the anonymous cross-brower compatible cookie question - I wonder if client code (ActiveX, SilverLight, Flash, Plug-Ins, etc.) could get you the MAC address of the client's NIC, which could then be used to uniquely identify the client on the server?

Even if this solution would work it's obviously fundamentally flawed since the problem is choice - the user can choose to not install the client code which will result in a system-wide crash killing everyone connected to the Matrix, which coupled with the destruction of Zion will make you responsible for the death of every human being on the planet.

Sorry, couldn't resist
Reply With Quote
  #20  
Old 08-15-2007, 07:51 AM
MKoslof's Avatar
MKoslofSharing cookies MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Quote:
Even if this solution would work it's obviously fundamentally flawed since the problem is choice - the user can choose to not install the client code which will result in a system-wide crash killing everyone connected to the Matrix, which coupled with the destruction of Zion will make you responsible for the death of every human being on the planet.
LOL!

In all seriousness though I really think client code is a dangerous option here. Because you lose complete control over it once the user starts playing with their browser/internet settings. I don't think its possible to get a client's MAC address from Javascript or client side scripting, actually I think in ASP.net it would be near impossible to get that through javascript - - however through an Active X plug-in installation initiated at the client machine, you could get the mac address of the client machine.

But I think we are really teetering on the edge here , I stick with my suggestion of having some sort of authentication or registeration mechanism, persist something, somewhere that identifies this person using the shopping cart
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Sharing cookies
Sharing cookies
Sharing cookies Sharing cookies
Sharing cookies
Sharing cookies
Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies Sharing cookies
Sharing cookies
Sharing cookies
 
Sharing cookies
Sharing cookies
 
-->