Home > Article > WeChat Applet > C# WeChat Development Series-Enable Developer Mode
1.0 Enable developer mode
①Fill in the server configuration
To enable development mode, you need to become a developer first, and edit mode and development You can only choose one mode (enter WeChat public platform=>Development=>Basic configuration) and you can see the following interface:
Click to modify the configuration, the following interface will appear:
Fill in the server address (URL), Token and EncodingAESKey, where URL is the interface URL used by developers to receive WeChat messages and events. 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.
At the same time, developers can choose the message encryption and decryption methods: plain text mode, compatibility mode and security mode. The mode selection and server configuration will take effect immediately after submission. Developers are advised to fill in and select carefully. The default state of encryption and decryption is plain text mode. To select compatibility mode and security mode, you need to configure the relevant encryption and decryption codes in advance. For details, please refer to the document on message body signature and encryption and decryption (WeChat official account message encryption and decryption development document).
②Verify the validity of the server address
After 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 you will 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, the 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(); } }
For more C# WeChat development series-enable developer mode related articles, please pay attention to the PHP Chinese website!