In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.