473,385 Members | 1,449 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,385 software developers and data experts.

Looking for cookies?

I'm doing this to get a listing of cookies:
HttpContext.Current.Request.Cookies.AllKeys

and
HttpContext.Current.Request.Cookies.AllKeys.ToStri ng()

However, that only gives:

System.String[]

How can I get a listing of cookies sent by the client?

Thanks,
Brett

Jan 24 '06 #1
4 1060
Just browse the array using a for or foreach loop. Here you are asking to
produce a string representation for the whole array so its just outputs its
type...
--
Patrice

"brett" <ac*****@cygen.com> a écrit dans le message de
news:11**********************@f14g2000cwb.googlegr oups.com...
I'm doing this to get a listing of cookies:
HttpContext.Current.Request.Cookies.AllKeys

and
HttpContext.Current.Request.Cookies.AllKeys.ToStri ng()

However, that only gives:

System.String[]

How can I get a listing of cookies sent by the client?

Thanks,
Brett

Jan 24 '06 #2
Thanks. That worked:
string allCookie = "";
foreach(string cookie in HttpContext.Current.Request.Cookies)
allCookie += "\r\n" + cookie;

My site sets a cookie but I don't see it in the email I'm sending from
the site, which uses the above code. The only cookie I see is
ASP.NET_SessionId. I checked in IE privacy to see if the cookie had
been blocked/allowed. The site isn't listed there at all. I checked
under Tools | Internet Options | Settings | View Files for the
particular cookie. I have only five text files (cookies) listed and my
site isn't one of them.

Any ideas how I can get the cookie set on my site to see if it outputs
in the loop?

Thanks,
Brett

Jan 24 '06 #3
CG
You need to first write cookie when responding first to the user request.
something like this :-

HttpCookie MyCookie = new HttpCookie("LastVisit");
DateTime now = DateTime.Now;

MyCookie.Value = now.ToString();
MyCookie.Expires = now.AddHours(1);

Response.Cookies.Add(MyCookie);

"brett" wrote:
Thanks. That worked:
string allCookie = "";
foreach(string cookie in HttpContext.Current.Request.Cookies)
allCookie += "\r\n" + cookie;

My site sets a cookie but I don't see it in the email I'm sending from
the site, which uses the above code. The only cookie I see is
ASP.NET_SessionId. I checked in IE privacy to see if the cookie had
been blocked/allowed. The site isn't listed there at all. I checked
under Tools | Internet Options | Settings | View Files for the
particular cookie. I have only five text files (cookies) listed and my
site isn't one of them.

Any ideas how I can get the cookie set on my site to see if it outputs
in the loop?

Thanks,
Brett

Jan 24 '06 #4
The cookie is actually set by a counter, which is a link in javascript
code to a JS file. I'm not setting the cookie. Is that something I
won't have access to? I guess that gets into extracting cookies from a
site other than my own, which is probably not allowed.

Thanks,
Brett

Jan 24 '06 #5

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

Similar topics

4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
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
9
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
8
by: CDARS | last post by:
Hi all, I have a confusing question on ASP.NET cookies usage: 1> Response.Cookies("test").value = Now 2> Response.Write(Request.Cookies("test").value) 3> 4> Response.write("<hr>") 5>...
6
by: Stephane | last post by:
Hi, I have a login page where if the user wants his access codes to be saved are set into a cookie. In the logout page, I want to delete those cookies. I tried this and this is not working at...
1
by: Alex Nitulescu | last post by:
I have the following very simple colde (while learning about cookies and session state): Private Sub cmdAddCookie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
4
by: tony | last post by:
I'm designing a survey form page that will be fairly complex and am becoming confident enough with PHP now to tackle most things. (Thanks to everyone here who has helped) Before I go too far...
3
by: Admin.TalkPC | last post by:
Hi people, I have now spent far too much time on this small problem, I am hopefully going to hand it over to you guys that are cleverer than I in this respect. Problem. I need to get all...
0
by: rn5a | last post by:
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.