![]() |
|
最新的关于Cookies的操作
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
广告招租,e-mail:yesize@hotmail.com
<html> Now lets get to the fun part, setting the cookie info. You can use the following code to set the cookie <% then we can set the cookie value using this: Ok, so now the cookie is set and we need to retrieve the info. You can use this to retrive the cookie <% then we post it to the website And its that easy. But wait, there is more. There are a few properties that you can set using cookies. The first property is the Domain property. This is the domain that the cookie originated from. The cookie Response.Cookies("name").Domain = "www.cookiemonster.com" The next important property is the Expires property. This specifies the date the cookie should expire. If When setting the date it can be set a couple of ways. You can use the current date and add or subtract Response.Cookies("name").Expires = Date + 365 Or you can set it to a specific date like this: Response.Cookies("name").Expires = #January 01, 1999# The Path property is the next important property when using cookies. This specifies in more detail the Response.Cookies("name").Path = "/this/is/the/path" The last property of the cookies object is the Secure property. If set, the cookie will only be set if the Response.Cookies("name").Secure = True * as a note, this doesnt mean the cookie is secure. Its just like every other cookie, just a text file. Using a dictionary cookie You could use this: Response.Cookies("name")("first") = "John" This gives you the option of storing all your neccesary info in one cookie. There are limits on how much data you can put on a clients browser. Most browsers allow you to place 20 cookies per domain at a maximum of 4k each. For more info about what cookies can and cant do, visit www.cookiecentral.com. So that basically wraps it up. Good luck in your cookie escapades and if you have any comments or questions feel free to contact me.
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||