基本信息
源码名称:ASP.NET微信公共平台/微信回复源码下载
源码大小:4.68KB
文件格式:.rar
开发语言:C#
更新时间:2014-04-17
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 1 元 
   源码介绍

ASP.NET微信公共平台

实现微信回复

 /// <summary>
    /// 返回信息结果(微信信息返回)
    /// </summary>
    /// <param name="weixinXML"></param>
    private void ResponseMsg(string weixinXML)
    {
        //回复消息的部分:你的代码写在这里
        System.Xml.XmlDocument doc = new XmlDocument();
        doc.LoadXml(weixinXML);
        XmlNodeList list = doc.GetElementsByTagName("xml");
        XmlNode xn = list[0];
        string FromUserName = xn.SelectSingleNode("//FromUserName").InnerText;
        string ToUserName = xn.SelectSingleNode("//ToUserName").InnerText;
        WriteLog("测试1");
        string MsgType = xn.SelectSingleNode("//MsgType").InnerText;
       
        string content = "", menu = "";
        if (MsgType.Equals("event"))
        {
            content = "欢迎你的加入!";
        }
        else
        {
            content = xn.SelectSingleNode("//Content").InnerText;
        }
        WriteLog("测试2");
        //content就是你要回复的内容,此间的业务逻辑可以自己定义
       

        string strresponse = "<xml>";
        strresponse = strresponse "<ToUserName><![CDATA[" FromUserName "]]></ToUserName>";
        strresponse = strresponse "<FromUserName><![CDATA[" ToUserName "]]></FromUserName>";
        strresponse = strresponse "<CreateTime>" DateTime.Now.Ticks.ToString() "</CreateTime>";
        strresponse = strresponse "<MsgType><![CDATA[text]]></MsgType>";
        strresponse = strresponse "<Content><![CDATA[" content menu "]]></Content>";
        strresponse = strresponse "<FuncFlag>0<FuncFlag>";
        strresponse = strresponse "</xml>";
        WriteLog("postStr:" content);
        Response.Write(strresponse);
        WriteLog("测试3");
    }