All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
JavaScript变换图片的几种方法_JavaScript技术_编程技术
visual c++控件使用实例
ASP.NET,2.0,页面状态持续程序_[Asp.Net教程]
PHP.MVC的模板标签系统之标签行为调度_php资料_编程技术
如何实现SQL Server 2005快速web分页_[SQL Server教程]
浅析SQL,Server全文检索查询_mssql学习_编程技术
ASP.NET下的一个实验MVC的小东西_[Asp.Net教程]
ASP.NET服务器控件编程之卷首语_[Asp.Net教程]
编辑web.config,保证ASP.NET的安全_.net资料_编程技术
项目调试时出现用到的一个组件“访问被拒绝”的解决方法_[Asp.Net教程]
Reading number is top 10 pictures
漂亮的跳舞妹妹2
英雄联盟超神十连杀截图
On the verge of extinction of the beach1
西游四格漫画(一)
乳娘帕梅拉安德森2
到底是谁撞谁呀?
The real super beauty5
Li Zongrui hunting video screenshots2
Send some Valentine's day cartoon
Sell the barbecue as says father du breul5
Download software ranking
Boxer vs Yellow3
仙剑奇侠传98版歌曲
Kung.Fu.Panda.2
Tram sex maniac 2 (H) rar bag2
Tram sex maniac 2 (H) rar bag17
The Bermuda triangle3
Tram sex maniac 2 (H) rar bag14
The Bermuda triangle2
美女写真2
小黑猫大战两米大花蛇
归海一刀 published in(发表于) 2014/1/30 1:18:35 Edit(编辑)
ASP.NET中读写cookie数据示例代码_[Asp.Net教程]

ASP.NET中读写cookie数据示例代码_[Asp.Net教程]

ASP.NET中读写cookie数据示例代码_[Asp.Net教程]
ASP.NET中的cookie:创建Cookie方法 (1)
Response.Cookies["userName"].Value = “admin";
Response.Cookies[“userName”].Expires = DateTime.Now.AddDays(1);
//如果不设置失效时间,Cookie信息不会写到用户硬盘,浏览器关闭将会丢弃。

ASP.NET中的cookie:创建Cookie方法 (2)
HttpCookie aCookie = new HttpCookie(“lastVisit”);
//上一次访问时间
aCookie.Value = DateTime.Now.ToString();
aCookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(aCookie);

ASP.NET中的cookie:访问Cookie方法(1)
if(Request.Cookies["userName"] != null)
Label1.Text = Server.HtmlEncode(Request.Cookies["userName"].Value);

访问Cookie方法(2)
if(Request.Cookies["userName"] != null) {
HttpCookie aCookie = Request.Cookies["userName"];
Label1.Text = Server.HtmlEncode(aCookie.Value);
}

ASP.NET中的cookie:创建多值Cookie方法 (1)
Response.Cookies["userInfo"]["userName"] = “admin";
Response.Cookies["userInfo"]["lastVisit"] = DateTime.Now.ToString();
Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(1);

ASP.NET中的cookie:创建多值Cookie方法 (2)
HttpCookie aCookie = new HttpCookie("userInfo");
aCookie.Values["userName"] = “admin";
aCookie.Values["lastVisit"] = DateTime.Now.ToString();
aCookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(aCookie);

ASP.NET中的cookie:读取多值Cookie
HttpCookie aCookie = Request.Cookies["userInfo"];
string userName=aCookie.Values[“userName”];
string lastVisit=aCookie.Values[“lastVisit”];

ASP.NET中的cookie:修改和删除Cookie
不能直接修改或删除Cookie,只能创建一个新的Cookie,发送到客户端以实现修改或删除Cookie。


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.