Exemple #1
0
        public static TG PostMsg <TS>(string uri, TS msgJson)
        {
            TG modelGet = null;
            HttpWebResponse response = null;
            Stream          stream   = null;

            try
            {
                string msg       = JsonConvertHelper.ConvertToJson(msgJson);
                byte[] msgBytes  = GetByteMsg(msg);
                byte[] htmlBytes = AsHttpAccess.Single.Post(uri, msgBytes);
                string html;
                try
                {
                    //byte[] htmlDecryptBytes = AesHelper.AesDecrypt(htmlBytes, "Jlfc_QQh.2018@11!~^$#GRqB++(())1");

                    html = _encoding.GetString(htmlBytes);
                }
                catch (Exception)
                {
                    html = "";
                }
                modelGet = JsonConvertHelper.ConvertToObject <TG>(html);
            }
            catch (System.Exception)
            {
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
                if (response != null)
                {
                    response.Close();
                }
            }
            return(modelGet);
        }