473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

multiple cookies with same name, why?

in the trace information
i am getting the following:

userID 81
username nick.......
projID 1
ProjName Jupiter
inDus 4F2EA4.........
ASP.NET_SessionId 0vg5mca.....
ProjID 2
ProjName Vis
ProjID 6

as you can see there are multiple instances of the same thing
which is no use to me as I am trying to track what the user
is doing by storing certain attributes in cookies

here is a sample of how i am adding the cookies [c#]:
System.Web.HttpCookie ProjName = new System.Web.HttpCookie("ProjName");

ProjName.Value = DdlProjects.SelectedItem.Text;

ProjName.Expires = DateTime.Now.AddDays(30);

System.Web.HttpCookie ProjID = new System.Web.HttpCookie("ProjID");

ProjID.Value = DdlProjects.SelectedItem.Value;

ProjID.Expires = DateTime.Now.AddDays(30);

Response.Cookies.Add(ProjName);

Response.Cookies.Add(ProjID);
this would explain some of the problems i have been having but is there no
way to overwrite the contents
of an existing value?

--
#-)
Nov 18 '05 #1
3 7605
its because the page is being called twice
not sure why this is happening either as the code that writes cookies is
wrapped in a !postback section

hmmm......
"evolve" <NOngnSPAMpeaSPAMrseNO_S__PAMhotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
in the trace information
i am getting the following:

userID 81
username nick.......
projID 1
ProjName Jupiter
inDus 4F2EA4.........
ASP.NET_SessionId 0vg5mca.....
ProjID 2
ProjName Vis
ProjID 6

as you can see there are multiple instances of the same thing
which is no use to me as I am trying to track what the user
is doing by storing certain attributes in cookies

here is a sample of how i am adding the cookies [c#]:
System.Web.HttpCookie ProjName = new System.Web.HttpCookie("ProjName");

ProjName.Value = DdlProjects.SelectedItem.Text;

ProjName.Expires = DateTime.Now.AddDays(30);

System.Web.HttpCookie ProjID = new System.Web.HttpCookie("ProjID");

ProjID.Value = DdlProjects.SelectedItem.Value;

ProjID.Expires = DateTime.Now.AddDays(30);

Response.Cookies.Add(ProjName);

Response.Cookies.Add(ProjID);
this would explain some of the problems i have been having but is there no
way to overwrite the contents
of an existing value?

--
#-)

Nov 18 '05 #2
found out why:

the thing that was writing the cookies out was when the user selected
something from a drop down
however
when the page is originally loaded
the previously chosen value(if exists) is then selected

this appears to call the drop down selected index changed function (even
though the user isn't driving it)
so i just put a
if(page.ispostback)
around the inside of the function and now it works fine

"evolve" <NOngnSPAMpeaSPAMrseNO_S__PAMhotmail.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
its because the page is being called twice
not sure why this is happening either as the code that writes cookies is
wrapped in a !postback section

hmmm......
"evolve" <NOngnSPAMpeaSPAMrseNO_S__PAMhotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
in the trace information
i am getting the following:

userID 81
username nick.......
projID 1
ProjName Jupiter
inDus 4F2EA4.........
ASP.NET_SessionId 0vg5mca.....
ProjID 2
ProjName Vis
ProjID 6

as you can see there are multiple instances of the same thing
which is no use to me as I am trying to track what the user
is doing by storing certain attributes in cookies

here is a sample of how i am adding the cookies [c#]:
System.Web.HttpCookie ProjName = new System.Web.HttpCookie("ProjName");

ProjName.Value = DdlProjects.SelectedItem.Text;

ProjName.Expires = DateTime.Now.AddDays(30);

System.Web.HttpCookie ProjID = new System.Web.HttpCookie("ProjID");

ProjID.Value = DdlProjects.SelectedItem.Value;

ProjID.Expires = DateTime.Now.AddDays(30);

Response.Cookies.Add(ProjName);

Response.Cookies.Add(ProjID);
this would explain some of the problems i have been having but is there no way to overwrite the contents
of an existing value?

--
#-)


Nov 18 '05 #3
found out why:

the thing that was writing the cookies out was when the user selected
something from a drop down
however
when the page is originally loaded
the previously chosen value(if exists) is then selected

this appears to call the drop down selected index changed function (even
though the user isn't driving it)
so i just put a
if(page.ispostback)
around the inside of the function and now it works fine

"evolve" <NOngnSPAMpeaSPAMrseNO_S__PAMhotmail.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
its because the page is being called twice
not sure why this is happening either as the code that writes cookies is
wrapped in a !postback section

hmmm......
"evolve" <NOngnSPAMpeaSPAMrseNO_S__PAMhotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
in the trace information
i am getting the following:

userID 81
username nick.......
projID 1
ProjName Jupiter
inDus 4F2EA4.........
ASP.NET_SessionId 0vg5mca.....
ProjID 2
ProjName Vis
ProjID 6

as you can see there are multiple instances of the same thing
which is no use to me as I am trying to track what the user
is doing by storing certain attributes in cookies

here is a sample of how i am adding the cookies [c#]:
System.Web.HttpCookie ProjName = new System.Web.HttpCookie("ProjName");

ProjName.Value = DdlProjects.SelectedItem.Text;

ProjName.Expires = DateTime.Now.AddDays(30);

System.Web.HttpCookie ProjID = new System.Web.HttpCookie("ProjID");

ProjID.Value = DdlProjects.SelectedItem.Value;

ProjID.Expires = DateTime.Now.AddDays(30);

Response.Cookies.Add(ProjName);

Response.Cookies.Add(ProjID);
this would explain some of the problems i have been having but is there no way to overwrite the contents
of an existing value?

--
#-)


Nov 18 '05 #4

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

Similar topics

0
by: Shagshag | last post by:
hello, how can i set multiple cookies like : Set-Cookie: cookiename1=value1; expires=Tue, 31-Mar-09 11:17:43 GMT; path=/; domain=www.domain.com Set-Cookie: cookiename2=value2; expires=Tue,...
1
by: mark.reichman | last post by:
First off.. Thanks to Grant Wagner for help in a previous thread related to this one. I am at a total loss... I have multiple fields in a form with the same name. Lets call the fields with the...
12
by: williamc | last post by:
Is there anything wrong with having several classes with the same name in the same style sheet? Something like... div.pagedown { margin: 20px 0px 20px 0px; border-top: 1px solid #caa;...
2
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as...
17
by: wolfing1 | last post by:
Like, I know if several checkboxes have the same name, I can get the ones that were checked after submit with a request.form("name") and maybe do a split(request.form("name"),",") to cycle through...
6
by: DJones | last post by:
I'm using the following code in my .Net application (.Net v1.1, Windows 2000) to write Session Cookies. HttpContext.Current.Response.Cookies("cookieSession")("SessionID") = strSessionID ...
0
by: mavrick_101 | last post by:
Hi, I thought we can not have multiple cookies with same name and in case you add a cookie with same name, it would overwrite the previous one. But when I write the cookies from cookie...
0
by: Moskie | last post by:
I have a form where the user is able to provide an arbitrary number of attachments. This is done through Javascript that dynamically generates INPUT fields, each of which has the NAME attribute set...
17
by: Sam Kong | last post by:
Hello, There are 1 or more select elements with the same name in a form. Let's say that the name of the select is 'select1' and the name of the form is 'form1'. If there's only one select I...
5
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I've been using stream_context_create() to send cookies along with a file_get_contents() call when requesting a remote page. This is useful if I need to pass information to the remote page that my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.