日期:2014-05-18 浏览次数:20578 次
 else
            {
                Response.Cookies["time"].Value = DateTime.Now.ToString();
                HttpCookie ct = new HttpCookie("count", (int.Parse(Request.Cookies["count"].Value) + 1).ToString());
                ct.Expires = DateTime.Now.AddMonths(1);
                Response.Cookies.Add(ct);
            }
------解决方案--------------------
你想干嘛??
直接说吧
------解决方案--------------------
Label1.Text = (Session["userInfo"] as UserInfo).UserName + "欢迎您!";
 if (Request.Cookies["name"] == null)
 {
 HttpCookie hc = new HttpCookie("name", (Session["userInfo"] as UserInfo).UserName);
 hc.Expires = DateTime.Now.AddMonths(1);
 HttpCookie tm = new HttpCookie("time", DateTime.Now.ToString());
 tm.Expires = DateTime.Now.AddMonths(1);
 HttpCookie ct = new HttpCookie("count", "1");
 ct.Expires = DateTime.Now.AddMonths(1);
hc.Domain="xxx.com";//域名
tm.Domain="xxx.com";//域名
ct.Domain="xxx.com";//域名
 Response.Cookies.Add(hc);
 Response.Cookies.Add(ct);
 Response.Cookies.Add(tm);
 }
 else
 {
 Response.Cookies["time"].Value = DateTime.Now.ToString();
 Response.Cookies["count"].Value = (int.Parse(Request.Cookies["count"].Value) + 1).ToString();
 }
本地就写localhost,传到网上就改网站的域名,不要http://www.