Response.Cookies["UsersName"].Expires=DateTime.Now.AddDays(100000000);

解决方案 »

  1.   

    把 HttpCookie 的 Expires 调为 3000年1月1日:
            HttpCookie cookie = new HttpCookie("mycookie");
            cookie.Expires = new DataTime( 3000,1,1 );
      

  2.   

    更方便的:
      cookie.Expires = DataTime.MaxValue ;//永不过期
      

  3.   

    楼上的 MaxValue 也太绝了吧,够用好几代。。晕。。我以前曾实验过,超过201? 年的cookies 是不行的,当时是win2k 的ie 5.01,现在不知ie 6的情况如何,我通常都只会设置成2010 年。