where are cookies stored ?

  • Thread starter Thread starter cmrchs
  • Start date Start date
C

cmrchs

Hi,

In Windows Vista: where does asp.net write its cookies?

I use
HttpCookie objCookie = new HttpCookie("nameCookie");

in Win2000 (and later) they used to be in
C:\Documents and Settings\Administrator\Cookies
but not anymore

I looked in
C:\Users\MyUserNameAppData\Roaming\Microsoft\Windows\Cookies

there are some cookies but the cookie I use in my webapp must be
stored somewhere else since
when I delete all cookies in this directory, my webapp still
recognises my cookie to be alive ... but where is it?

thank you
Chris
 
....AND in the Temporary Internet Files folder which you can't see without turning off UAC

You will have to also uncheck the *Hide protected operating system files*
option in Folder Options to see those files

CCleaner has a great cookie manager (Options, Cookies) feature in it,
and can delete (Cleaner option) all of the cookies to.

You might want to give it a try.

CCleaner : http://www.ccleaner.com/




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
Hi,

In Windows Vista: where does asp.net write its cookies?

I use
HttpCookie objCookie = new HttpCookie("nameCookie");

in Win2000 (and later) they used to be in
C:\Documents and Settings\Administrator\Cookies
but not anymore

I looked in
C:\Users\MyUserNameAppData\Roaming\Microsoft\Windows\Cookies

there are some cookies but the cookie I use in my webapp must be
stored somewhere else since
when I delete all cookies in this directory, my webapp still
recognises my cookie to be alive ... but where is it?

thank you
Chris

Nowhere.

A session cookie is only stored in memory. You have to set the
expiration date of the cookie to make it persistent, then it will be
stored as a file.
 
Nowhere.

A session cookie is only stored in memory. You have to set the
expiration date of the cookie to make it persistent, then it will be
stored as a file.

hello,

thank you all for your suggestions but I still have my problem !!

I looked in
C:\Users\MyUserNameAppData\Roaming\Microsoft\Windows\Cookies
C:\Users\MyUserNameAppData\Roaming\Microsoft\Windows\Cookies\Low
and in Temporary Internet Files folder,

deleted everything in the folders, reload my file in the browser but
it still uses information stored in a cookie

maybe you can give it a try, it is a small html application (listing
available at the end of this message)

I have a main file : "counter.html" that shows a collection of CDs
In that file, a counter is holding track of the amount of times the
user has visited the page (basically the counter increases after every
refresh in the browser)
once a maximum is reached the user is redirected to the other file
"signup.html"

so, what I try to do is 'reset' the application by deleting the cookie
physically or by resetting the counter inside the cookie just by
editing it
but for that I need to know where the cookie is located
The purpose of my app is to show students how fragile cookies are and
to be able to show them WHERE cookies are located !

thank you for giving it a try


**************************************************
the content of signup.html
**************************************************
<html>
<head>
<title></title>
</head>

<body>
<h1>
You reached the maximum amount of visits to this site.
<br />
You need to sign up if you want to use it again....</h1>
</body>
</html>

**************************************************
the content of counter.html:
**************************************************
<html>
<head>
<title>Using cookies to create a personal Web page hit counter </
title>

<script type="text/javascript" language="javascript">

function getCookie(name)
{
for (var i=0; i < bytes.length; i++)
{
nextbite = bytes.split("="); // break into name and value

if (nextbite[0] == name) // if name matches
return unescape(nextbite[1]); // return value
}
return null;
} // getCookie()

function setCookie(name, value)
{
if (value != null && value != "")
document.cookie= name + "=" + escape(value)
+ "; expires="
+ expiry.toGMTString();
bytes = document.cookie.split("; "); // update cookie bytes
} // setCookie()

var bytes = document.cookie.split("; ");
var today = new Date();
var expiry = new Date(today.getTime()+28*24*60*60*1000);

var headCount = getCookie("headCount");
var userName = getCookie("userName");
if (headCount == null)
headCount = 1;
if (userName == null)
{
userName = prompt("Please Enter Your Name:", "Anonymous");
if (userName == null || userName == "")
userName="Anonymous";
}
if (headCount == 1) // welcome for first visit
{
alert("Welcome, " + userName + ", this is your first visit");
}
else if (headCount <= 10)
{
alert("Welcome back " + userName + "\r\nYou have been here "
+ headCount + " time(s).");
}
else
window.location = "signup.html";

headCount++;

setCookie("headCount", headCount);
setCookie("userName", userName);

</script>

</head>
<body>
<h1>
Welcome</h1>
<h2>
CD Collection</h2>
<table border="1" id="Table1">
<tr bgcolor="#9acd32">
<th align="left">
Title
</th>
<th align="left">
Artist
</th>
</tr>
<tr>
<td>
CD Title1
</td>
<td>
Artist1
</td>
</tr>
<tr>
<td>
CD Title2
</td>
<td>
Artist2
</td>
</tr>
<tr>
<td>
CD Title3
</td>
<td>
Artist3
</td>
</tr>
</table>
</body>
</html>
 
Back
Top