编程开发 > ASP > 文章内容

Cookie读写例子

2010-8-17编辑:feimeimei
  writecookie.asp
  %@ Language=VBScript
  %
  %Response.Buffer=true%
  HTML
  HEAD
  META NAME=GENERATOR Content=Microsoft Visual Studio 6.0
  TITLE写Cookie的示例/TITLE
  /HEAD
  BODY
  %
  Response.Write 写Cookie:
  Response.Cookies = KeyValue1
  Response.Cookies = KeyValue2
  Response.Cookies.Expires = July 31, 1999
  Response.Cookies = KeyValue1
  Response.Cookies = KeyValue2
  Response.Cookies.Expires = July 31, 1999
  ‘Response.Cookies.Path = /testasp/
  ‘这个在使用的时候要注意
  ‘是指定在那个目录的文件才可以读取这个cookie的内容。
  ‘在本例子中。只有在testasp这目录下的文件才可以读取
  ‘Cookie2的内容。
  %
  /BODY
  /HTML
  -
  readwrite.asp
  %@ Language=VBScript %
  HTML
  HEAD
  META NAME=GENERATOR Content=Microsoft Visual Studio 6.0
  TITLE读Cookie的示例/TITLE
  /HEAD
  BODY
  %Response.Write 读取Cookie:
  dim cookie,key
  for each cookie in Request.Cookies
  if Request.Cookies.haskeys then
  Response.Write
  Cookie 名字:cookieBRBR
  for each key in Request.Cookies
  Response.Write Key 名字:key,值:Request.CookiesBR
  next
  else
  Response.Write Cookie 名字:Request.CookiesBR
  end if
  next
  %
  /BODY
  /HTML
  Email: aben@chinasky.net
  HomePage: http://www.chinasky.net/aben ;
ASP编程要点ABC之一

热点推荐

登录注册
触屏版电脑版网站地图