惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - kwame

CXX0017错误的解决办法 基础知识--is & as 的区别 - kwame 基础知识--变量和常量 - kwame - 博客园 基础知识--Boxing & unBoxing 基础知识--值类型和引用类型 用Visual C#创建Windows服务程序 (转)用C语言编写Windows服务程序的五个步骤 昨天的事今天来写也叫昨天的日记吧?? 我是个被窥视狂? 一个馒头和一个*六*合*彩*网站引发的血案 *六*合*彩*网站也能做成这样不容易呀! 取得一段汉语的每个字的首字母 网页效果集合(小技巧) Oracle中隐式游标和显式游标的教训[同事的经历] C#.net word 受控编程系列1-向word中插入图片 安装和部署企业程序库(Installation and Deployment of Enterprise Library) OA需要分析3 OA需求分析2 OA需求分析1
写入、读取 cookie 无聊顺便复习了下前面学的东西!
kwame · 2006-03-01 · via 博客园 - kwame

转自:http://www.cnblogs.com/thcjp/archive/2006/03/01/340323.html

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="vb" runat="server">
'写入cookie
sub writcooks_click(sender as object,e as eventargs)
'定义并创建名为cookieexmp的cookie对象
 dim newcookie as httpcookie = new httpcookie("cookieexmp")
 dim thc as string = cstr(txtname.text)
 dim nnv as string = cstr(sex.selecteditem.text)
'添名为 name ,值为 thc 的子键。后两条语句作用与其内似。
 newcookie.values("name") =thc
 newcookie.values("sex")=nnv
 newcookie.values("dj") = "5"
 newcookie.values("dt") = datetime.now.date()
 newcookie.expires = datetime.now.adddays(10) '这句是做什么的,我不知道,有知道的麻烦告诉我下,谢谢!
 response.cookies.add(newcookie) ' 写入cookie对象
 response.Write("<h1>写入完成</h1><p><p>")
end sub
'读取cookie
sub tbn_click(sender as object, e as eventargs)
'由request对象获取cookieexmp
dim getcookie as httpcookie = request.Cookies("cookieexmp")
response.Write("<h2>以下是读出来的东西</h2><hr><br>")
response.Write("名称:" & getcookie.values("name") & "<br>")
response.Write("性别:" & getcookie.values("sex") & "<br>")
response.Write("会员等级:" & getcookie.values("dj") & "<br>")
response.Write("时间:" & getcookie.values("dt") & "<br>")
end sub
'用户名框动作
sub w_name(sender as object,e as eventargs)
lbl.text="用户名" & txtname.text & "正确,请继续输入"
end sub
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form runat="server">
  <p>请输入用户名:
    <asp:TextBox ID="txtname" AutoPostBack="true" TextMode="SingleLine" runat="server" OnTextChanged="w_name" />  &nbsp;&nbsp;
  <asp:Label ID="lbl" runat="server"/></p>
请选择性别:
<asp:RadioButtonList ID="sex" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>男</asp:ListItem>
<asp:ListItem>女</asp:ListItem>
</asp:RadioButtonList>
  <p>
    <asp:Button ID="writcooks" Text="写入cookie" runat="server" OnClick="writcooks_click"/>     
    <asp:Button ID="tbn" Text="读取cookie" runat="server" OnClick="tbn_click"/>     
</p>
</form>
</body>
</html>