Cookies
In this tutorial you learn how to use cookies. Say you wanted to remember your logni information Kinda like on this web page you login it remembers your login information with the use of cookies so everytime you come back you don't have to re-login. If you logout it deletes the cookie.Cookies
In this tutorial you learn how to use cookies. Say you wanted to remember your logni information Kinda like on this web page you login it remembers your login information with the use of cookies so everytime you come back you don't have to re-login. If you logout it deletes the cookie.
Cookies are little bits of data stored by your browser. they can be verry handy. Say you have a admin section of your web page but you don't like loging in all the time a salution to this would be to use cookies in your login script to store your information on your computer so when ever you go to your web page it can check the cookie and automaticaly log you in.
Here is how to make cookies:
Response.Cookies(""nameOfCookie"") = someValue
or like this
Response.Cookies(""nameOfCookie"")(""nameOfSubKey"") = someValue
The first part gives the cookie a name and the second part is a sub key in wich to hold data. Cookie can contain one value or it can have sub keys and each sub key holding its own value.
Here is an example of a cookie I used in a members script I once made.
Response.Cookies(""MemOnly"").Expires = #6/10/2002#
Response.Cookies(""MemOnly"")(""MemName"") = somename
Response.Cookies(""MemOnly"")(""MemPass"") = somepass
The first part of this cookie is the .Expires line this is really important since it tells the browser when to delete the cookie if this line isn't there the cookie will be deleted as soon as the browser is closed. Cookies are good for storing small things like the last time you visited a web site or your login information.
here is how you would read from a cookie
Request.Cookies(""CookieName"")
or
Request.Cookies(""CookieName"")(""SubKeyName"")
To use values stored in cookies you would append the values to verials like this
SomeVerialbe = Request.Cookies(""SomeCookie"")(""SomeKey"")
You can check to see if a cookie exists by doing this
If Request.Cookies(""CookieName"") = True Then
some code
End If
If You want to want to re-write cookies you have to re-write all the data to the cookie. if you have 3 subkeys and only want to change one you will have to re-write all of them or the others will be lost.
Don't just sit there like a lemon! Reply!
Got something to say? Now's the time to share it with the author and everybody else that reads this posting! Lemons need not apply.