这个问题 困扰了我很久 希望看到的懂的帮我一把 !
int counter,time;if (Request.Cookies["time"] == null)
{
counter = 1;
}
else
{
counter = int.Parse(Request.Cookies["main"]["time"].ToString());
counter += 1;
}
Response.Write("您是第" + counter + "次访问本站<br>");
Response.Write("您上次访问时间是" + Request.Cookies["main"]["times"]);
HttpCookie mycookie = new HttpCookie("main");
mycookie["time"] = counter.ToString();
mycookie.Expires = DateTime.Now.AddDays(30d);
Response.Cookies.Add(mycookie);
Response.Cookies["main"]["times"] =time .ToString(DateTime.Now);
错误 1 与“int.ToString(string)”最匹配的重载方法具有一些无效参数
错误 2 参数“1”: 无法从“System.DateTime”转换为“string”