|
FoxWeb Support Team support@foxweb.com email |
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:
|
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 |