Get the App
SLTechnology News&Howtos  ›  Development  › 

How to connect to asp.net in Wechat development

Shulou Source: shulou.com Published: 2022-06-03 11:07:59 09月10日 Update

This article mainly introduces how to access asp.net in the development of Wechat. It is very detailed and has a certain reference value. Interested friends must finish reading 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 } these are all the contents of the article "how to connect to asp.net in Wechat development". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Development access similar content article value interest god boy buddy log more most knowledge industry information information channel channel encryption reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei Linux Shulou Information MySQL