Do not use on any
shared computer
August 30, 2008 04:34am pdt
 
[x]
Attachment Details

Losing Cookies/Sessions with IE Browsers

Tags: Microsoft, Internet Explorer
I was just wondering if anyone here have experienced the same situation I'm in
right now. In a nutshell, I'm noticing on my ecommerce website the cookie holding
the shopping cart ID is being dropped after several clicks through the website
only with IE browsers. With the same code, it works just fine with
FireFox/Netscape browers.

Here's how my database driven shopping cart works on my site. In the
Application.cfm I have these lines of code:

<!--- -------------------------------------------------------------------- --->
<!--- SHOPPING CART RELATED FUNCTIONS START HERE  --->
<!--- -------------------------------------------------------------------- --->

<cfif NOT IsDefined("COOKIE.LastCartID")>
      <!--- Set a cookie if the user decides to purchase later --->
      <cfset newCCID = #CreateUUID()#>
      <cfcookie name="LastCartID" value="#newCCID#">
      <!--- Insert tracking variables here  --->
      <cfquery username="#application.qryUserName#" password="#application.qryPassword#" name="checkTransID" datasource="#Application.DSN#" dbtype="ODBC">
            SELECT            OrderTransID
            FROM            tblOrderTransactions
            WHERE            OrderTransID = '#SESSION.CFTOKEN#'
      </cfquery>
      <!--- If no record, create new order transaction ID  --->
      <cfif CompareNoCase(checkTransID.RecordCount,1)>
            <cfquery username="#application.qryUserName#" password="#application.qryPassword#" name="createEZaccount" datasource="#Application.DSN#" dbtype="ODBC">
            INSERT INTO tblOrderTransactions(OrderTransID,CustIP)
            VALUES('#SESSION.CFTOKEN#','#CGI.REMOTE_ADDR#');
            </cfquery>
      </cfif>
      <!--- Create CartID in SESSION var  --->
      <cflock timeout="30" throwontimeout="No" name="#SESSION.SessionID#" type="EXCLUSIVE">
            <cfset SESSION.CartID = COOKIE.LastCartID>
      </cflock>
      
      
</cfif>
      
<cfif NOT IsDefined("SESSION.CartID")>
      <cflock timeout="30" throwontimeout="No" name="#SESSION.SessionID#" type="EXCLUSIVE">
            <cfset SESSION.CartID = COOKIE.LastCartID>
      </cflock>
</cfif>

<cfparam name="thisCartID" default="#COOKIE.LastCartID#">
<!--- -------------------------------------------------------------------- --->
<!--- -------------------------------------------------------------------- --->

A first time visitor will have a new cart ID created and saved to a cookie
(COOKIE.LastCartID) and to a session variable (SESSION.CartID). Once the mini
shopping cart is reached, a query is made to the cart database to find contents
of the cart and will display the data. New customers will return 0 contents
obviously but returning customers who added items in a previous session will
display as such. Now, what I noticed is after adding an item to the cart and
making about 20 or so click throughs on the site, the cart returns 0 items and
with my debugging code on, a whole new cookie ID is created as well as other
session variables (CFID, CFTOKEN, etc.). Using the cfdump feature, I was able to see right before a new cookie.LastCartID is created, new session and cookies for CFID & CFTOKEN are generated.

I'm just wondering if anyone else experienced this and what strategies should I
undertake to resolve this. This is an issue specific to IE browsers. Thanks.

Orlando
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: AD_Tech
Solution Provided By: AD_Tech
Participating Experts: 2
Solution Grade: A
Views: 36
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by b0lsc0tt

Rank: Master

Expert Comment by b0lsc0tt:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by AD_Tech
Author Comment by AD_Tech:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by JICrew
Expert Comment by JICrew:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by AD_Tech
Accepted Solution by AD_Tech:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628