In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
            
                    
                
2025-11-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to be certified as a developer in the development of Wechat public platform. Net, the content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
This code will be used once for authentication, and will not be used later:
Const string Token = "XXXXX"; / / your token protected void Page_Load (object sender, EventArgs e) {string postStr = ""; if (Request.HttpMethod.ToLower () = = "post") {System.IO.Stream s = System.Web.HttpContext.Current.Request.InputStream; byte [] b = new byte [s.Length]; s.Read (b, 0, (int) s.Length); postStr = System.Text.Encoding.UTF8.GetString (b) If (! string.IsNullOrEmpty (postStr)) {/ / ResponseMsg (postStr); Response.Write (ResponseMsg (postStr)); Response.End ();} / / WriteLog ("postStr:" + postStr);} else {Valid () }} / verify Wechat signature / * sort the three parameters token, timestamp and nonce in lexicographic order / * concatenate the three parameter strings into a string for sha1 encryption / * the encrypted string obtained by the developer can be compared with signature to indicate that the request originated from Wechat. / / private bool CheckSignature () {string signature = Request.QueryString ["signature"] .ToString (); string timestamp = Request.QueryString ["timestamp"] .ToString (); string nonce = Request.QueryString ["nonce"] .ToString (); string [] ArrTmp = {Token, timestamp, nonce}; Array.Sort (ArrTmp); / / in dictionary order string tmpStr = string.Join ("", ArrTmp); tmpStr = FormsAuthentication.HashPasswordForStoringInConfigFile (tmpStr, "SHA1"); tmpStr = tmpStr.ToLower () If (tmpStr = = signature) {return true;} else {return false;} .private void Valid () {string echoStr = Request.QueryString ["echoStr"] .private void Valid (); if (CheckSignature ()) {if (! string.IsNullOrEmpty (echoStr)) {Response.Write (echoStr); Response.End () }} / write log (for tracking) / private void WriteLog (string strMemo) {string filename = Server.MapPath ("/ logs/log.txt"); if (! Directory.Exists (Server.MapPath ("/ / logs//")) Directory.CreateDirectory ("/ / logs//"); StreamWriter sr = null Try {if (! File.Exists (filename)) {sr = File.CreateText (filename);} else {sr = File.AppendText (filename);} sr.WriteLine (strMemo);} catch {} finally {if (sr! = null) sr.Close () }} the above content is how to be certified as a developer in the development of Wechat public platform. Net, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





            
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.