473,491 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem storing data in a cookie...

Hi

I have an HTML search page that contains a drop-down box with
approximately 78,000 items in it.

The actual content of this select box varies depending upon some of the
parameters a user has chosen, so this needs to be loaded (possibly
several times as they change their parameters) and I've got this
working using AJAX.

However, as you can well imagine, this takes quite some time to get
this data from the database and turn into the select box.

To cut down time, I've put this in the Session("xxx") object held on
the server and this manages to cut it down from 15 seconds to 10
seconds. This tells me that it simply takes quite a lot of time to
transfer this data around the internet.

So...what I'd REALLY like to do is to save it to a cookie. Now, I've
found several examples on the web of how to write and read from cookies
but unfortunately it's not working in my hands. I suspect that it's
something to do with the value for the cookie...

The value would be something like this ("...." implies multiple lines).

value = "Please select a product code &nbsp;nbsp;<select
name=""x""><option
value=""y"">y"</option>.....</select>&nbsp;&nbsp;78,000products
available".

Any ideas/suggestions would be most appreciated

Griff

Jun 13 '06 #1
2 1315

Just to provide some more info....

The JavaScript function that updates the web page AND *attempts* to set
the cookie's value is as follows:

function xmlHttpChange()
{
if (XmlHttp.readyState==4)
{
// Load the response text into a local variable
productCodeData = XmlHttp.responseText;

// Update the web page with this data

document.getElementById('ProductCodeSelection').in nerHTML=productCodeData;

// Save to cookie (e.g. "myAppName_Acme_1234")
var cookieName = "myAppName_" + document.getElementById

('accountName').value + "_" +
document.getElementById('userID').value;

document.cookie = cookieName+"="+escape(productCodeData);

XmlHttp=null;
}
}

When I check whether anything is held in the cookies, I put in the
following alert:

alert("document.cookie.length = " + document.cookie.length);

This returns ""document.cookie.length = 0"

Something's not quite right here....

Griff

Jun 13 '06 #2
Hi,

Griff wrote:
Hi

I have an HTML search page that contains a drop-down box with
approximately 78,000 items in it.

The actual content of this select box varies depending upon some of the
parameters a user has chosen, so this needs to be loaded (possibly
several times as they change their parameters) and I've got this
working using AJAX.

However, as you can well imagine, this takes quite some time to get
this data from the database and turn into the select box.

To cut down time, I've put this in the Session("xxx") object held on
the server and this manages to cut it down from 15 seconds to 10
seconds. This tells me that it simply takes quite a lot of time to
transfer this data around the internet.

So...what I'd REALLY like to do is to save it to a cookie. Now, I've
found several examples on the web of how to write and read from cookies
but unfortunately it's not working in my hands. I suspect that it's
something to do with the value for the cookie...

The value would be something like this ("...." implies multiple lines).

value = "Please select a product code &nbsp;nbsp;<select
name=""x""><option
value=""y"">y"</option>.....</select>&nbsp;&nbsp;78,000products
available".

Any ideas/suggestions would be most appreciated

Griff


It might be due to the size. A cookie can contain maximum 4KB, IIRC. I
am not sure what the behaviour is if you try to store a longer string.

I posted my CCookie object on my website, it's an abstraction of the
cookie API which allows you to call methods instead of manipulating the
cookie string. It also has methods allowing to check if session cookies
and/or permanent cookies are enabled. The code is self-documented.

http://www.galasoft-lb.ch/myjavascri...kie/index.html

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3956
by: ndsoumah | last post by:
hello guys I'm trying to get access to variables I put in a session variable from another page and it fails... here's the exact situation main file page1.php
1
2123
by: Blossom | last post by:
Hi there, I have a problem with storing my Cookies. I made a servlet in which I store a Cookie (in the doGet()-method) to detect whether a user has already visited my webpage. I used the...
7
2134
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but...
8
1638
by: Phoenix | last post by:
Here's a challenge that is killing me: I've got 2 web servers and a SQL Server and about 5,000 'users' who stay connected to the site all day. I have a page that is supposed to be 'real-time',...
7
2898
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
7
1867
by: Mike | last post by:
I have developed an application, for psyc patients.... they type in very personal information in a web form to help them work through problems in their lives. Once they enter the info, I encrypt...
3
4193
by: Milsnips | last post by:
Hi there, i had a small project where i used a session to store the shopping cart, but if it times out, the user loses the cart. Then i thought instead of using session, i'll store the cart in a...
2
1994
by: Mythran | last post by:
We followed an example found on MSDN to create an encrypted FormsAuthenticationTicket and storing the ticket in a cookie. Is this the "correct" way to store the authentication ticket? We are...
1
1160
by: mercea | last post by:
Hi guys, I am taking a column from a table and comparing each row in that table with a similar column in a gridview row by row. For each identical answer, grade increments by 1. after all the rows...
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6978
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.