This article mainly introduces the steps and methods of enabling developer mode in WeChat development. It has certain reference value. Let’s take a look at it with the editor
Enable developer mode##①Fill in the server configuration
To enable development mode, you need to become a developer first. And you can only choose one of the editing mode and the development mode (enter the WeChat public platform => Development => Basic Configuration) and you can see the following interface:
Click to modify Configuration, the following interface will appear:
Fill in the server address (URL), Token and EncodingAESKey, where the URL is the interface used by developers to receive WeChat messages and events
URL. Token can be filled in by developers and used to generate signatures (the Token will be compared with the Token contained in the interface URL to verify security). EncodingAESKey is manually filled in by the developer or randomly generated, and will be used as the message body encryption and decryption key. ②Verify the validity of the server addressAfter the developer submits the information, the WeChat server will send a GET request to the filled in server address URL , the GET request carries four parameters.
# Developers verify the request by checking the signature (the verification method is below). If it is confirmed that this GET request comes from the WeChat server, please return the echostr parameter content as it is, then the access will take effect and become a developer successfully, otherwise the access will fail (Note: WeChat server only supports port 80
).Use GET request with the above parameters to request the server, specific implementation code:
public void InterfaceTest() { string token = "配置时填写的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 (!string.IsNullOrEmpty(echoString)) { HttpContext.Current.Response.Write(echoString); HttpContext.Current.Response.End(); } }
The above is the detailed content of C# WeChat development method to enable developer mode. For more information, please follow other related articles on the PHP Chinese website!