Ejemplo n.º 1
0
        private static T GetRemote <T>(HttpContextBase context, string method, string userId) where T : class
        {
            string json = null;

            try
            {
                json = HttpProcUtil.Post(
                    new Uri(
                        string.Format("{0}/AuthApi/{1}", AuthConfig.ServerUrl, method)
                        ),
                    string.Format("uid={0}&appkey={1}",
                                  context.Server.UrlEncode(userId),
                                  AuthConfig.AppKey)
                    );
                var list = JsonConvert.DeserializeObject <T>(json);
                return(list);
            }
            catch
            {
                if (string.IsNullOrWhiteSpace(json))
                {
                    context.Response.Redirect(AuthClient.GetLogOnUrl());
                    //    throw new Exception(method + " 无法验证您的登录信息,请重新登录");
                }
                throw new Exception(method + "时发生错误:" + json);
            }
        }