Enterprise ID development: Enable callback mode and callback
How can I enable the callback mode for enterprise ID development? Simply log on to the PC Edition, click the Application Center, select the desired application, and then click "enable callback mode?
It seems not that simple !!
We can see that there are only three URL, Token, and EncodingAESKey parameters at the core. Can these parameters be entered at will?
Can I enter 1 URL as needed?
It is certain that it cannot be entered at will. If you don't believe it, try it. Because Click OK to send information to this URL. Therefore, this URL must be accessible from the Internet.
In addition, the background must process the sent information. For example, if the URL is http://www.hao123.com/, it can be stored on the Internet, but it will be displayed when you click "save:
Echostr Verification Failed. Please check whether the decryption is correct and output the plaintext echostr
Can I enter 2Token as needed?
Yes. I have not found any special requirements.
Can I enter 3EncodingAESKey as needed?
It cannot be entered at will. It must be a combination of numbers and letters and must contain 43 characters. We recommend that you use a random generation.
We know that configuring a URL that can be accessed from the Internet at the URL does not guarantee that it is saved successfully. What should we do in the background?
For example, I configure http: //.../TestWeixin. ashx
The encryption and decryption functions to be called in the background.
The background code of TestWeixin. ashx is:
Public void ProcessRequest (HttpContext context) {if (context. request. httpMethod. toLower () = "post") {} else // call {Valid () ;}} private void Valid () {string msg_signature = HttpContext when you click Save. current. request. queryString ["msg_signature"]; string timestamp = HttpContext. current. request. queryString ["timestamp"]; string nonce = HttpContext. current. request. queryString ["nonce"]; string decryptEc HoString = ""; // The parsed plaintext string echoStr = HttpContext. current. request. queryString ["echoStr"]; bool isok = CheckSignature (msg_signature, timestamp, nonce, echoStr, ref decryptEchoString); if (isok) {if (! String. isNullOrEmpty (decryptEchoString) {HttpContext. current. response. write (decryptEchoString); HttpContext. current. response. end () ;}} public bool CheckSignature (string signature, string timestamp, string nonce, string echostr, ref string retEchostr) {string token = "token "; // configure token string corpId = "corpId"; // corpid, string encodingAESKey = "encodingAESKey"; // configure tokenencodingAESKey WXBizMs GCrypt wxcpt = new WXBizMsgCrypt (token, encodingAESKey, corpId); // call the provided function int result = wxcpt. verifyURL (signature, timestamp, nonce, echostr, ref retEchostr); // call the provided function if (result! = 0) {LogInfo. error ("ERR: VerifyURL fail, ret:" + result); return false;} return true; // ret = 0 indicates the verification is successful, and retEchostr indicates the plaintext, you need to use retEchostr as the return parameter of the get request and return it to the enterprise number.}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.