C # WeChat Development Series-1.0 enable developer mode,

Source: Internet
Author: User

C # Development Series-1.0 enable developer mode,

1.0 enable developer Mode

① Fill in the Server Configuration:

 

To enable the development mode, you must first become a developer. You can select only one edit mode and development mode (go to the public platform> development => basic configuration) to view the following interface:

 

 

Click modify configuration. The following page is displayed:

 

 

Enter the server address (URL), Token, and EncodingAESKey. The URL is the interface URL used by the developer to receive messages and events. The Token can be entered by the developer as needed to generate a signature (the Token will be compared with the Token contained in the interface URL to verify security ). The EncodingAESKey is manually entered or randomly generated by the developer and will be used as the accesskey for message body encryption and decryption.

 

In addition, developers can select the plaintext mode, compatibility mode, and security mode for message encryption and decryption. The Mode Selection and server configuration will take effect immediately after submission. Please be careful when entering and selecting. The default encryption/Decryption mode is plain text. To select the compatible mode and security mode, you must configure the relevant encryption/decryption code in advance, for more information, see the message body signature and encryption/Decryption section (public message encryption/Decryption development document ).

 

② Verify the validity of the server address:

After the developer submits the information, the server sends a GET request to the server Address URL filled in. The GET request carries four parameters.

 

 

The developer verifies the request by verifying signature (The following is a verification method ). If you confirm that the GET request is from the server, return the content of the echostr parameter as it is, and the access takes effect. If the access succeeds, the access fails (note: the server only supports port 80 ).

The specific implementation code is as follows:

1 public void InterfaceTest () 2 {3 string token = "token entered during configuration"; 4 5 string echoString = HttpContext. current. request. queryString ["echoStr"]; 6 string signature = HttpContext. current. request. queryString ["signature"]; 7 string timestamp = HttpContext. current. request. queryString ["timestamp"]; 8 string nonce = HttpContext. current. request. queryString ["nonce"]; 9 10 if (! String. IsNullOrEmpty (echoString) 11 {12 HttpContext. Current. Response. Write (echoString); 13 HttpContext. Current. Response. End (); 14} 15}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.