Beispiel #1
0
        public ActionResult Logout()
        {
            Response.Buffer          = true;
            Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            Response.CacheControl    = "no-cache";
            JObject json = new JObject();

            try
            {
                string deviceId = Session["openid"].ToString();

                string language = Session["language"].ToString();
                CleanAll();
                string result = authMgr.invokLogout(deviceId, language);

                STReturn ret = Global.chkJsonStats(result);

                Session.Abandon();
                Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
                if (int.Parse(ret.retCode) == (int)MsgCode.OPR_SUCC)
                {
                    return(Content(result));
                }
                else
                {
                    json.Add("code", ret.retCode);
                    json.Add("msg", ret.retMsg);
                    return(Content(json.ToString()));
                }
            }
            catch (WeChatException ex)
            {
                json.RemoveAll();
                json.Add("code", ex.WeChatErrorCode);
                json.Add("msg", ex.WeChatErrorMessage);
                return(Content(json.ToString()));
            }
            catch (Exception ex2)
            {
                json.RemoveAll();
                json.Add("code", (int)MsgCode.SYSTEM_ERR);
                json.Add("msg", ReturnMsg.msgList[(int)MsgCode.SYSTEM_ERR]);
                return(Content(json.ToString()));
            }
        }