public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string name       = context.Request.Form["name"];
            string pwd        = context.Request.Form["pwd"];
            string checkState = context.Request.Form["checkState"];

            Bll.StudentsBll studentsBll = new Bll.StudentsBll();
            var             student     = studentsBll.GetAllList().Where(m => m.StuName == name && m.Pwd == pwd).ToList();

            if (checkState == "true")
            {
                //存入cookie
                context.Response.AppendCookie(new HttpCookie("userId")
                {
                    Value   = student[0].Id,
                    Expires = DateTime.Now.AddDays(7)
                });
                context.Response.AppendCookie(new HttpCookie("userName")
                {
                    Value   = student[0].StuName,
                    Expires = DateTime.Now.AddDays(7)
                });
            }
            else
            {
                //存入session
                context.Session["userId"] = student[0].Id;

                context.Session["userName"] = student[0].StuName;
            }

            context.Response.Write(JsonConvert.SerializeObject(student));
        }
 public static bool Add(string name, string pwd, string email)
 {
     Bll.StudentsBll bll = new Bll.StudentsBll();
     return(bll.Add(new Model.Students()
     {
         Id = Guid.NewGuid().ToString(),
         StuName = name,
         Pwd = pwd,
         Email = email,
         ImgUrl = "",
         Bj = "Rb软工互172"
     }));
 }