Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where do cookies go?

Status
Not open for further replies.

jsteph

Technical User
Oct 24, 2002
2,562
0
0
US
Hi,
I've taken a stab at doing a small website, and it's using cookies for a variety of purposes. I'm using IE 6. I know that in win98 there is a directory called 'c:\windows\cookies', and also 'c:\windows\Temporary Internet Files' and similar ones for win2k under 'c:\documents and settings\someuser...'.

But...I can't for the life of me find the cookies I've created. I know the cookies are somewhere because the functionality of the website couldn't work at all if the cookies didn't exist. So where else would I look?

I've tried using the Internet Options and clearing all cookies, offline content, files and history, then running the site, then doing a search for all files modified within a day and size 1k or smaller (the data in the cookies is very minor), and nothing comes up. Where are they???
--Jsteph
 
The session based cookies used by ASP are not persistent so they are not cached on the drive. You won’t find any for your site unless you write your own code to create a persistent cookie. Now as you already know, the location, is OS dependent and you did not state what OS your looking on [wink]

-pete
 
palbano,
Thanks, that saved me alot of frustration!
--Jsteph
 
In IE, look at Tools/Internet Options, then click the 'Settings' button in the Temporary Internet Files section. This shows you the place where cookies and other files are stored.

Cookies are stored here when your ASP code uses the Response.Cookies("Key").Value = "Fred" type code, or emits an HTML cookie header section.

This is stored in a file called:
cookie:<username>@<website-url>

This file is deleted when you close the browser UNLESS you put an expiry date on a cookie that is set in the future.

If you use the session(&quot;key&quot;).value = &quot;fred&quot; type code in your ASP page, then these values are stored in-memory on the web server. They are like cookies, but are deleted after the session closes (20 minutes of user in-activity).

 
Merlin,
I'm using the syntax Response.Cookies(&quot;thecookie&quot;) = xxx. And I looked in the spot where the Options show the files should be, but coudln't find these cookies.

I then used the Delete option, doing All Offline Content, then ran the site, and the cookies werent there, just copies of the .asp page itself.

On a related note, the session(&quot;key&quot;).value is something I've used, but only on the .asp side. I was wondering how I would access that value in javascript on the client, that is, what is the syntax?
Thanks,
--jsteph
 
>> how I would access that value in javascript on the client

Code:
document.cookie

-pete
 
pete,
I'm looking for the syntax for what's created using:

session(&quot;xxx&quot;).value = &quot;something&quot;

...where would I put the &quot;xxx&quot; in the document.cookie syntax? Thanks,
--jsteph
 
No!
session is a SERVER SIDE object created by ASP.
cookies are a CLIENT SIDE feature, maintained by the browser. cookie values are sent with EVERY client request - so they should be kept small. ASP reads these cookie values, and places them into the request.cookies collection for you.

To forward information stored in the session collection to the browser, say for jscript use, you need to either:
add it to the URL as a query string parameter; or
add hidden input fields to a named form (use response.write to output these)
create javascript code in your ASP code

URL: myPage.asp?pname=fred
alert ( document.location.url );
//I can't remember how to extract each query value
//from url in javascript
hidden fields:
<Form name=&quot;myform&quot; ...>
<input type=&quot;hidden&quot; name=&quot;pname&quot; value=&quot;fred&quot;)
alert (document.myform.pname.value);
JavaScript creation:
<% response.write (&quot;var pname = 'fred';&quot;) %>

Or something like that.

Note: hidden form fields are very useful, and are created automatically when DTC's (design time controls) and ASP.Net controls are used - but they tend to rely on forms posting back to themselves.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top