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

Reading number is top 10 articles
GridView,的各种用法(4)_[Asp.Net教程]
visual c++中常用MFC文件及库文件
sql server日期时间函数_[SQL Server教程]
PHP5.2+APACHE2.2+BugFree1.0的安装_php资料_编程技术
Asp.net,5种页面转向方法_[Asp.Net教程]
深入探讨PHP中的内存管理问题_php资料_编程技术
PHP5,OOP编程之代理与定制异常_php资料_编程技术
delphi内存映像的步骤
安全基础:PHP后门的隐藏技巧测试报告_php资料_编程技术
asp.net2.0两句代码搞定文件上传_[Asp.Net教程]
Reading number is top 10 pictures
美丽的风景--让你目瞪口呆
分手的感悟
Take you to walk into the most true north Korea rural1
The money of more than 100 countries and regions15
The real super beauty9
The Soviet union swimsuit exposure in the 70 year2
毛俊杰-能量永动机
清扫五脏垃圾,我有绝招
2012 national geographic daily picture2
The little woman's bright wire3
Download software ranking
Boxer's Top ten classic battle7
Tram sex maniac 2 (H) rar bag13
Take off clothes to survival
WebService在.NET中的实战应用教学视频 → 第1集
Tram sex maniac 2 (H) rar bag8
Macromedia Dreamweaver 8
打鸟视频
Boxer's Top ten classic battle6
VeryCD电驴(EasyMule) V1.1.9 Build09081
Tram sex maniac 2 (H) rar bag11
归海一刀 published in(发表于) 2014/1/30 1:25:40 Edit(编辑)
C#,javascript,读写Cookie_[Asp.Net教程]

C#,javascript,读写Cookie_[Asp.Net教程]

C# javascript 读写Cookie_[Asp.Net教程]
//C#写读Cookie

第一:写Cookies
Response.Cookies["UserName"].Value="Guest";
Response.Cookies["UserName"].Expires=DateTime.Now.AddDays(1);

第二:添加Cookies
HttpCookie userName_zhengshu_Cookie = new HttpCookie("uname");
userName_zhengshu_Cookie.Value = "陈xx";

HttpCookie userLession_zhengshur_Cookie = new HttpCookie("lcode");
userLession_zhengshur_Cookie.Value = "chen jian ping";

userName_zhengshu_Cookie.Path = "/";
userLession_zhengshur_Cookie.Path = "/";

//限定有效期
userLession_zhengshur_Cookie.Expires = DateTime.Now.AddDays(1);
userName_zhengshu_Cookie.Expires = DateTime.Now.AddDays(1);

Response.Cookies.Add(userLession_zhengshur_Cookie);
Response.Cookies.Add(userName_zhengshu_Cookie);

//Cookies添加
Response.AppendCookie(user_cookies);

//取值
Response.Write(Request.Cookies["uname"].Value);



//javascript写读Cookie
function Set_Cookie()
{
var setValue="陈xx";
var exdate=new Date();
exdate.setDate(exdate.getDate()+365);
document.cookie="userLession"+ "=" +setValue+";expires="+exdate.toGMTString()+";path=/";
alert("已经写入Cookie");
}

function Get(){ 
  var cookieString=new String(document.cookie)
  var cookieHeader = "userLession="
  var beginPosition = cookieString.indexOf(cookieHeader)
  if(beginPosition != -1)
  {
    alert(cookieString.substring(cookieHeader.length,cookieString.indexOf(";")));
  }
}


添加到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.