Date:  04/27/2004 03:16:17 PM Msg ID:  001988
From:  FoxWeb Support Thread:  001981
Subject:  Re: Cookies ASP / Foxweb
This should work fine as long as you set the cookie path appropriately.  Please see notes in my previous reply.

FoxWeb Support Team
support@foxweb.com email

Sent by Steve Ames on 04/27/2004 01:31:13 PM:
Visitors go to an ASP file which saves the variable in a cookie. Then the user is sent to an fwx script.
 
 
 
Sent by FoxWeb Support on 04/27/2004 12:45:40 PM:
Are you referring to ASP, or FWX scripts?  It seems that your code uses a micture of both:  In FoxWeb the command to send a cookie would be Response.SetCookie("myvariable", varx).  In ASP the command to read the cookie would be Request.Cookie("myvariable").
 
In any case, you may want to look at the notes about cookie paths in the Session Management topic of the FoxWeb documentation.  Here's an excerpt:
 

Cookie Paths

Each cookie stored on the user's Web browser has a path associated with it. When the browser requests a file stored in the same location or in a subdirectory of the path specified in the cookie, the browser automatically sends the cookie to the server. Unless the script explicitly specifies a path when setting a cookie, the browser associates the newly received cookie with the same path as the one containing the script. For example, if a FoxWeb script residing in /ContactMine sends a cookie to a browser, then each time that same browser retrieves any file residing in that directory, or one of its sub-directories, the browser will send the cookie back the server.

To specify a path for a cookie other than the default application path, you must pass the desired path to the Response.SetCookie method. The following example assigns the server root path / to a cookie called UserName. Since the server root is the highest level path on the server, this ensures that the cookie will be sent along with all subsequent requests, no matter where the requested file resides:

<% Response.SetCookie("UserName", "John Doe", , "/") %>

In the above example the Expiration Date parameter is omitted, which means that the cookie will be purged when the browser is re-started.

Note: Most Web browsers, including Netscape Navigator and Microsoft Internet Explorer, preserve the case of the cookie path. This means that if the case of the path stored with the cookie does not match the case of the path specified in the URL, the browser will not forward the cookie to the server.

Windows Web servers and FoxWeb are not case sensitive in regard to the paths contained in URLs. This means that the path /CONTACTMINE/CONTACT.FWX and /ContactMine/contact.fwx point to the same script. Browsers, on the other hand, are case sensitive. This means that if a script that was called with the first path sends a cookie to the browser without specifying a path, and also contains a link to itself using the second path, the browser will not send the cookie back to the server when the link is clicked, because the two paths do not match. The stored cookie is associated with the path /CONTACTMINE, but the requested URL is for the path /ContactMine.

To avoid this problem from happening, you must ensure that all URLs to FoxWeb scripts have the same case. Alternatively, you can always associate cookies with the server's root directory, as in the example above.

FoxWeb Support Team
support@foxweb.com email

Sent by Steve Ames on 04/27/2004 12:29:57 PM:
I am new to cookies and have hit a wall. I wrote a cookie using an
ASP file by using the command :-
 
  varx = "anything"
  Response.Cookies("myvariable")=varx
 
When I try and read the cookie in Foxweb I get nothing. I am using  :-
 
  varx = Request.GetCookie("myvariable")

 
 
If I look at the cooker the variable varx is correctly saved. What am I doing wrong ??