日期:2014-05-17  浏览次数:20434 次

大虾来看看我的代码?谢谢了。。。有问题啊。。

/// <summary>
        /// 实现登陆时密码保存
       /// </summary>
       /// <param name="param">下拉选项</param>
       /// <param name="usname">用户名</param>
       /// <param name="ps">密码</param>
        public void Cookie(int param, string usname, string ps)
        {
            HttpResponse response = HttpContext.Current.Response;
            if (response != null)
            {
                HttpCookie Cookie = new HttpCookie("Login");
                if (Cookie != null)
                {
                    if (param == 0)
                    {
                        Cookie.Expires = DateTime.Now.AddDays(1);
                    }
                    else if (param == 1)
                    {
                        Cookie.Expires = DateTime.Now.AddDays(7);
                    }
                    else if (param == 2)
                    {
                        Cookie.Expires = DateTime.Now.AddYears(1);
                    }
                    Cookie.Values.Set("USER", usname);
                    Cookie.Values.Set("PASS", ps);
                    Response.SetCookie(Cookie);
                }
           &nb