Ejemplo n.º 1
0
        public void Invoke(string signature, string timestamp, string nonce, string echostr)
        {
            string token = ConfigurationManager.AppSettings["WeiXinToken"];

            LogHelper.WriteLog("post结果:" + echostr);
            if (BasicApi.CheckSignature(token, signature, timestamp, nonce))
            {
                LogHelper.WriteLog("post结果:" + echostr);
                if (!string.IsNullOrEmpty(echostr))
                {
                    Response.Write(echostr);
                    Response.End();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 微信接入的测试
        /// </summary>
        private void ResponseServer()
        {
            string myToken = CommonHelper.GetAppValue("myToken");

            if (string.IsNullOrEmpty(myToken))
            {
                File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "error.txt", "token节点没有配置");
            }

            string echoString = HttpContext.Current.Request.QueryString["echoStr"];
            string signature  = HttpContext.Current.Request.QueryString["signature"];
            string timestamp  = HttpContext.Current.Request.QueryString["timestamp"];
            string nonce      = HttpContext.Current.Request.QueryString["nonce"];

            if (BasicApi.CheckSignature(myToken, signature, timestamp, nonce))
            {
                if (!string.IsNullOrEmpty(echoString))
                {
                    HttpContext.Current.Response.Write(echoString);
                    HttpContext.Current.Response.End();
                }
            }
        }