码迷,mamicode.com
首页 > 微信 > 详细

获取分解微信消息

时间:2014-11-06 17:16:13      阅读:436      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   sp   div   on   log   

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;
            }

获取分解微信消息

标签:style   blog   http   color   os   sp   div   on   log   

原文地址:http://www.cnblogs.com/ZengFei/p/4079038.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!