找传奇、传世资源到传世资源站!

ASP.NET微信公共平台/微信回复源码下载

8.5玩家评分(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");
    } 

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复