can't find the javascript cookie anywhere

J

Jason Shohet

I'm writing a js cookie from an asp.net page. A .NET cookie won't do.
Inside the js func. that writes the cookie, I do this code to see the cookie
afterwards:

window.document.write(document.cookie);

That shows me this on the asp.net page:
machinename=jshohet; ASP.NET_SessionID=adt2......

So I know the cookie is being written. Otherwise i wouldn't see the name I
gave it (machinename) and the value (jshohet). Prob is, I'm looking in
documents & settings for the logged in user & i don't see a cookie in it,
except for some yahoo cookie ;)

TY for any help J. Shohet
 
P

Patrice

If you don't have an expiration date, this is a temporary cookie (ie. the
cookie is cleared when IE closes ; technically it is likely in memory rather
than being persisted to a file).

Patrice
 
J

Jason Shohet

hi Patrice
Without closing the browser, I go to documents & settings, & I dont' see the
cookie. I see others there, but not the one I just wrote. Its just not
there. I'm using IE 6 on XP. I've tried it with setting expiration &
without, and the cookie is never there, even though the browser is still
open.
 
J

Jason Shohet

could it be that .NET's index.dat file is taking over for the javascript,
and somehow stuffing my cookie in there :(
I do see index.dat's date in the documents & settings for the logged in
user, updated to the time i set the cookie, but could just be coincidence.
 
J

Jason Shohet

its not in the index.dat, i'm sure of that. But the js cookie is not being
written it seems. Here's my js func.

<script language="javascript">
function setCookie(name, value, expires, path, domain, secure)
{
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=Mon, 27-Apr-2005 00:00:00 GMT) +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : ""); */

window.document.write(document.cookie);
}
</script>

And I'm calling it from the onkeyup of an asp.NET textbox:
onkeyup="setCookie('machinename', 'shohet', '', '', '', '')"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top