By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,749 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,749 IT Pros & Developers. It's quick & easy.

Cookies Count

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.