Exemple #1
0
        /// <summary>
        /// 用户退出
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string LogOut(HttpContext context)
        {
            string resultText = "\"ok\":{0},\"msg\":\"{1}\"";
            string resultMsg  = string.Empty;

            try
            {
                T_User user = Static.GetUserForCookie();

                //记录日志
                if (user != null)
                {
                    LogHelper.WriteOperationLog("退出系统", user.LoginName + " 成功退出系统", user.LoginName, Static.GetIPadress());
                }

                //清除当前用户权限Cookie数据
                Static.DeleteUserRightForCache(user);

                //清除当前会话用户数据
                Static.DeleteUserToCookie();

                resultMsg = string.Format(resultText, "0", "成功退出!");
            }
            catch (Exception ex)
            {
                resultMsg = string.Format(resultText, "0", "服务器异常!");
            }
            return("{" + resultMsg + "}");
        }