private string GetToken() { var key = "gh_a2e48791ecc1"; var token = CacheCore.Get <string>(key); if (string.IsNullOrEmpty(token)) { token = WeChatInteractiveHelper.GetToken("wxf9ade153117809bf", "c876b01424956a2f7f7d1bee9dbb0acd"); CacheCore.Set <string>(key, token, 60); } return(token); }
public void IndexInteractive() { //获取微信请求参数 string signature = HttpContext.Current.Request.QueryString["signature"]; string timestamp = HttpContext.Current.Request.QueryString["timestamp"]; string nonce = HttpContext.Current.Request.QueryString["nonce"]; string echostr = HttpContext.Current.Request.QueryString["echostr"]; string token = "InteractiveWeChat"; //加密sha1对比signature字符串 if (WeChatInteractiveHelper.CheckSignature(token, signature, timestamp, nonce)) { //返回echostr参数内容 Write(echostr); } }