获取分解微信消息

string postStr = "";
           Stream s = System.Web.HttpContext.Current.Request.InputStream;
            byte[] b = new byte[s.Length];
            s.Read(b, 0, (int)s.Length);
            postStr = Encoding.UTF8.GetString(b);

            if (!string.IsNullOrEmpty(postStr))
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(postStr);
                XmlElement rootElement = doc.DocumentElement;
                //XmlNode MsgType = rootElement.SelectSingleNode("MsgType");
                RequestXML requestXML = new RequestXML();
                requestXML.ToUserName = rootElement.SelectSingleNode("ToUserName").InnerText;
                requestXML.FromUserName = rootElement.SelectSingleNode("FromUserName").InnerText;
                requestXML.CreateTime = rootElement.SelectSingleNode("CreateTime").InnerText;
                requestXML.MsgType = rootElement.SelectSingleNode("MsgType").InnerText;
            }

获取分解微信消息

上一篇:微信公众号开发系列教程一(调试环境部署续:vs远程调试)


下一篇:js中then()的用法