当前位置: 首页 > 图文教程 > 网络编程 > 编程10000问 > 如何在ASP中恰当地运用Cookies?

编程10000问
如何计算下载一个文件需要多长时间?
如何检测用户第一次访问我的网站并显示友好信息?
如何判断URL格式是否符合规范?
如何取得服务器上的用户组列表?
如何显示数据库的结构?
如何显示最后十名来访者?
如何显示随机信息?
如何向前端推送用户请求的信息?
如何修改被表单引用的ASP页面?
如何验证IP地址?
如何用ASP建立Index Server查询对象并为其参数赋值?
如何用ASP输出HTML文件?
如何用表单的方式推送请求的信息?
如何远程读取数据库页面?
如何在ASP里显示进度条?
如何自动更新导航栏?
如何阻止别人非法链接你网站的图片?
怎样获知数据库的连接属性?
如何按时间显示最新标志
禁止站外提交表单(author:killer)

编程10000问 中的 如何在ASP中恰当地运用Cookies?


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 32 ::
收藏到网摘: n/a

remberme.asp

' 用户提交个人信息.

<

response.Cookies("information")("姓名")=request.form("name")

response.Cookies("information")("顾客号")=request.form("id")

response.Cookies("information")("来自")=request.form("from")

……

' 定义一个名为informationCookies字典,你可以定义更多,如果你需要.

>

<html>

<head>

<title>星河影动</title>

</head>

<body>

<div align="center"><center>

<table border="0" cellspacing="0" width="600" height="86">

<tr>

<td height="65"><p align="center"><font>星河影动之Cookies应用</font></td>

</tr>

<tr>

<td align="center" height="62"><form method="post" action="remberme.asp">

<p><font>   

姓名: <input type="text" name="name" size="20">   <br>

顾客号: <input type="text" name="id" size="20">   <br>

来自: <input type="text" name="nation" size="20">   

</font><br>

<input type="submit" value="我想查询">  

<input type="reset" value="重写">

</p>

</form>

</td>

</tr>

</table>

</center></div>

</body></html>

welcome.asp

' 显示Cookies中的内容.

<html>

<head>

<title>Cookies Demo</title>

</head>

<body>

姓名

<=request.Cookies("information")("name")>

<p>

顾客号

<=request.Cookies("information")("id")>

<p>

来自

<=request.Cookies("information")("from")>

</body></html>