public AjaxResult CheckSso(HttpContextBase httpContext) { AjaxResult ajaxResult = new AjaxResult(); User user = (User)httpContext.Session[Constants.USER_KEY]; if (user == null) { ajaxResult.flag = false; ajaxResult.message = "session is null"; } else { String[] result = sysOperatorService.CheckSso(user.SysOperator.ID, httpContext.Session.SessionID).Split(new char[] { '|' }); ajaxResult.attachment = user.SysOperator; ajaxResult.dateTime = DateTime.Now; if (Convert.ToBoolean(result[0])) { ajaxResult.flag = true; ajaxResult.message = "ok"; } else { httpContext.Session.Clear(); httpContext.Session.Abandon(); ajaxResult.flag = false; ajaxResult.message = "有相同用户登陆或同一机器两用户登陆,您已被系统强制退出!"; } } return ajaxResult; }
public ActionResult Json() { AjaxResult result = new AjaxResult(); result.message = "information信息"; result.dateTime = DateTime.Now; result.attachment = new TreeNode(); return Json(result,JsonRequestBehavior.AllowGet); }