Пример #1
0
        /// <summary>
        /// 读取网关发回的数据
        /// </summary>
        /// <returns></returns>
        public static GatewayData ReadNotifyData()
        {
            var gatewayData = new GatewayData();

            if (IsGetRequest)
            {
                gatewayData.FromUrl(HttpUtil.QueryString);
            }
            else
            {
                if (IsXmlData)
                {
                    var    reader  = new StreamReader(HttpUtil.Body);
                    string xmlData = reader.ReadToEnd();
                    reader.Dispose();
                    gatewayData.FromXml(xmlData);
                }
                else
                {
                    try
                    {
#if NETSTANDARD2_0
                        gatewayData.FromForm(HttpUtil.Form);
#else
                        gatewayData.FromNameValueCollection(HttpUtil.Form);
#endif
                    }
                    catch { }
                }
            }

            return(gatewayData);
        }
Пример #2
0
        /// <summary>
        /// 读取网关发回的数据
        /// </summary>
        /// <returns></returns>
        public static GatewayData ReadNotifyData()
        {
            var gatewayData = new GatewayData();

            if (IsGetRequest)
            {
                gatewayData.FromUrl(HttpUtil.QueryString);
            }
            else
            {
                if (IsXmlData)
                {
                    var    reader  = new StreamReader(HttpUtil.Body);
                    string xmlData = reader.ReadToEnd();
                    reader.Dispose();
                    gatewayData.FromXml(xmlData);
                }
                else
                {
                    try
                    {
                        gatewayData.FromForm(HttpUtil.Form);
                    }
                    catch { }
                }
            }

            return(gatewayData);
        }