Example #1
0
        /// <summary>
        // 获取用户名
        /// </summary>
        /// <returns></returns>
        public TeUser GetUserNameForSerVice(string Josn)
        {
            Newtonsoft.Json.Linq.JObject LoginUser = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject <object>(Josn);
            TeUser user = new TeUser();

            if (LoginUser != null)
            {
                string U = LoginUser["data"]["result"].ToString().Replace("[", "").Replace("]", "");
                user = Newtonsoft.Json.JsonConvert.DeserializeObject <TeUser>(U);
            }
            return(user);
        }
Example #2
0
        /// <summary>
        //Cookie 获取
        /// </summary>
        /// <returns></returns>
        public TeUser GetUserCookie()
        {
            TeUser U = new TeUser();

            string UserStr = GetCookieToString("Dfbg_OAUser");

            if (string.IsNullOrEmpty(UserStr))
            {
                Context.Response.Redirect("~/Home/Login");
                return(null);
            }
            else
            {
                U          = Newtonsoft.Json.JsonConvert.DeserializeObject <TeUser>(UserStr);
                U.userName = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Server.UrlDecode(U.userName));
                return(U);
            }
        }