public bool CheckCookies(HttpCookieCollection cookies) { if (cookies == null || cookies.Count == 0 || cookies.Count <4)return false; if (string.IsNullOrEmpty(cookies[GLB.id].Value) || string.IsNullOrEmpty(cookies[GLB.userId].Value) || string.IsNullOrEmpty(cookies[GLB.userName].Value) || string.IsNullOrEmpty(cookies[GLB.depId].Value)) { return false; } userDal = new UserDAL(); bool flag = userDal.CheckValid(new UserStatus() { //记得加上异常处理 ID = Convert.ToInt32(cookies[GLB.id].Value), UserID = cookies[GLB.userId].Value, Dep = new Department() { ID = Convert.ToInt32(cookies[GLB.depId].Value) } }); userDal.ReturnUnitToPool(); return flag; }