最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
最新的关于Cookies的操作
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
stored in the cookie. In this case we will use info submitted by the user via this form:
Now let's get to the fun part, setting the cookie info. You can use the following code to set the cookie
value on the clients machine:
<%
Response.buffer = True
' first we put the data from the form into a variable
name = Request.Form("name")
'then we can set the cookie value using this:
Response.Cookies("name") = name
%>
Ok, so now the cookie is set and we need to retrieve the info. You can use this to retrive the cookie
data:
<%
' first we retrive the data and set it to a variable
name = Request.Cookies("name")
' then we post it to the website
Response.Write (name)
%>
And it's 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
can only be read by the domain it originated from. It is set by default to the domain in which it was
created, but you can alter it for your needs. You can set it using this:
Response.Cookies("name").Domain = "www.cookiemonster.com"
The next important property is the Expires property. This specifies the date the cookie should expire. If
it is set to a past date then it will expire when the browser is closed.
When setting the date it can be set a couple of ways. You can use the current date and add or subtract
-
上一个: 关于DataGrid等控件中的自动编号
-
下一个: asp实现sql的备份与恢复
相关文章
- Servlet中Cookie增、删、改、查的例子 11-18
- zepto cookie操作使用例子 06-26
- python中cookielib模块的使用方法 06-23
- Tornado中的secure cookie使用例子 08-21
- 可增强Firebug功能的十款Firefox插件,Firefox查看Cookie插件Firecookie 07-24
- cookie使用中问题方法总结 05-24