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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client Side Cookies

Status
Not open for further replies.

spazman

Programmer
May 29, 2001
500
CA
I set a cookie using VBScript(client side), okay fine no problem I can read it with client side scripts etc etc. But In the ASP code that the page posts too I want to kill the cookie, but When I do a Response.Cookies("DMatter") = "", the cookie still has value of what it was set too in the client side script. Correct me if I;m wrong but isn;t a cookie a cookie? Set at the server or client either should be able to access the other.

Am I missing somthing?
 
I believe that the server-side cookies are completely different from the client-side ones. I have tried something similar and found that I needed to set the "expires=" to date-1 (yesterday) on the client-side cookie...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Well I never would have guessed. I just tested this, I did a response.write to write the client side cookies and no results!
 
We know that client-side cookies reside on the client's pc, but where do server-side cookies reside? I'm guessing that you use the Request and Response objects to manipulate them, they also reside on the client's pc. You just cannot access them with client-side scripts - they are just sent along with all of the header info when your PC requests a page...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Well I don't know, I wrote a page that displays back all the info in a the users cookies, I use this for testing. It's a server side (ASP) so it uses Response. and Request. to access/manipulate the cookies I went to this page today and the cookie I sent with a client side script shows in that list, with a value.

My thinking after posting was that a client-cide cookie would not be readable by a server side script due to security or privacy concerns, but this doesn't seem to be the case with my cookies.asp reading my client set cookie. As well I just tested the other way a client side script reading a server side cookie and it was read.

I think initialing what I was doing I was doing wrong, thus I thought that there may be a differnec in client set and server set cookies.

In answer to your question cookies that are longer than the session are stored in a txt file on your hard drive, I.E. Cookies that have a an expiry date, cookies without an expiry date expire when you close the browser, so I would assume thay are stored in memory. If you'd like the code to view cookies with client side script let me know I will post it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top