473,398 Members | 2,403 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,398 software developers and data experts.

Cookies Count

This is how I am creating & then reading cookies:

<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
'create cookies
Response.Cookies("UserName").Value = "Ron"
Response.Cookies("UserName").Expires = "12/31/2008"

Response.Cookies("UserDetails")("FirstName") = "Ronnie"
Response.Cookies("UserDetails")("LastName") = "Nathan"
Response.Cookies("UserDetails")("LastVisitedDate") =
DateTime.Now.ToString("d")
Response.Cookies("UserDetails")("LastVisitedTime") =
DateTime.Now.ToString("T")
Response.Cookies("UserDetails").Expires = "12/31/2008"

'read cookies count
Response.Write(Request.Cookies.Count & " cookies created!
<br>")

'read cookies
Response.Write("Full Name : " & Request.Cookies("UserDetails")
("FirstName") & " " & Request.Cookies("UserDetails")("LastName") &
"<br>")

Response.Write("User Name : " &
Request.Cookies("UserName").Value & "<br>")

Response.Write("Last Visit: " & Request.Cookies("UserDetails")
("LastVisitedDate") & " at " & Request.Cookies("UserDetails")
("LastVisitedTime"))
End Sub
</script>

As such, the cookie gets created successfully. ONLY 1 cookie gets
created but when I run the above code for the first time i.e. when the
cookie doesn't exist, Request.Cookies.Count evaluates to 3 & on
further page refreshes, Request.Cookies.Count evaluates to 5.

How is Request.Cookies.Count evaluating to 3 & 5 when ONLY 1 cookie
gets created (in the Temporary Internet Files folder)?

Thanks

Sep 28 '07 #1
0 1570

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

Similar topics

0
by: Zap | last post by:
I'm having trouble verifying the cookie that I leave on a client's computer. Here is the code: <% Dim sPath, filesys, count, getValue, update, twohrs sPath =...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
1
by: Karl | last post by:
Hi there! I have a big Problem with some Javascript: On a website, i want to paste some "confirm", if the visitor's browserlanguage is not "de". when he confirm, he'll be redirected to the...
1
by: Ravi | last post by:
Hi , i am trying to pass the same session Id to all the webrequest, but sometimes the response.cookies returns zero and sometimes one. is this to do something with cookies expire. In this sample...
2
by: Jon Cosby | last post by:
I'm trying to use a cookie to track the customer's running total. Private Sub dgProds_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
5
by: Mr Newbie | last post by:
I am having trouble writing cookies despite adding the cookie to the Response.Cookeies collection. The Request.Browser.Cookies returns TRUE so I know the browser is storing cookies and I can even...
0
by: beaker | last post by:
Hello, this is my first foray into the world of web programming, and none of the searching I've done to solve this problem has left me any the wiser, so I hope someone out there can help... ...
4
by: Water Cooler v2 | last post by:
I am practicing Cookies in .NET. Its working fine but when I want to clear my cookies, the statement, Response.Cookies.Clear does not work. What gives? Here's what I do:
2
by: Issos | last post by:
Is there a way to just receive the cookie(s) from an webrequest in ASP.NET? The function I'm using at the moment can handle cookies... but it will also get the full response of the request... I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.