我正在尝试创建一个 cookie 并计算我访问该页面的次数。这是代码:
<%
var visits=0;
visits=Request.Cookies("count");
if(visits="0") {
Response.Cookies("count")=1;
Response.Write("Welcome! You Have Visited This Page First Time");
}
else {
Response.Cookies("count")+=1;
Response.Write("You Have visited this page" + Request.Cookies("count"));
if(visits="1") {
Response.Write(" time before");
}
else {
Response.Write(" times before");
}
}
%>
我得到的输出为:
Welcome! You Have Visited This Page First Time
即使我尝试刷新页面,我也会得到与输出相同的上述语句。提前感谢您的帮助