In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the example analysis of Wechat development asp.net access method, the article is very detailed, has a certain reference value, interested friends must read it!
First create a Default.aspx. Check it out in Page_Load: (MyLog is a log class, which can be ignored) about checkSignature () is pretty much what we found. Post it here.
MyLog.DebugInfo ("request default.aspx"); String echoStr = Request.QueryString ["echostr"]; MyLog.DebugInfo ("echoStr:" + echoStr); if (this.checkSignature ()) {if (! string.IsNullOrEmpty (echoStr)) {MyLog.DebugInfo ("echostr:" + echoStr); Response.Write (echoStr); Response.End ();}}
The most important thing is the sentence Response.End (). If you don't add this sentence, you can't get it in. About checkSignature () is about the same as what we found. Post it here.
Private bool checkSignature () {string signature = Request ["signature"]; string timestamp = Request ["timestamp"]; string nonce = Request ["nonce"]; MyLog.DebugInfo ("signature: {0}, timestamp: {1}, nonce: {2}", signature, timestamp, nonce); string token = TOKEN; string [] tmpArr = new string [] {token, timestamp, nonce}; Array.Sort (tmpArr); string tmpStr = string.Join ("", tmpArr) / / sha1 encryption System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider (); byte [] secArr = sha1.ComputeHash (System.Text.Encoding.Default.GetBytes (tmpStr)); tmpStr = BitConverter.ToString (secArr) .replace ("-", ") .ToLower (); MyLog.DebugInfo (String.Format (" after parse: {0} ", tmpStr)); if (tmpStr = = signature) {MyLog.DebugInfo (" true "); return true;} else {return false;}}
This is mainly because of the problem of Response.End (), which has led me to do it for a long time. I would like to make a record of those who can help.
Another possibility is that Token verification failed because of Wechat server. Just click twice more, don't click just once like me!
The above is all the contents of this article "example Analysis of Wechat developing asp.net access method". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.