使用cookie保存上次登录时间

      编程心得 2007-7-12 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();
                }

标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}