2007/07/12 | 使用cookie保存上次登录时间
类别(编程心得) | 评论(0) | 阅读(230) | 发表于 17:27

                if (Request.Cookies["LastVisit"] == null)
                {
                   Response.Cookies.Add(new HttpCookie("LastVisit"));
                   Response.Cookies["LastVisit"].Value = DateTime.Now.ToString();

                   
                    Session["label"] = "this is the first time you login!";
                }
                else
                {
                    string str=Request.Cookies["LastVisit"].Value.ToString();
                  
                    Session["label"] = str;
                    Response.Cookies["LastVisit"].Value = DateTime.Now.ToString();
                }

0

评论Comments