国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home WeChat Applet WeChat Development .Net development WeChat public platform certification 'become a developer' example detailed explanation

.Net development WeChat public platform certification 'become a developer' example detailed explanation

Apr 22, 2017 pm 03:03 PM
.net

This article mainly provides a detailed analysis of the "Become a Developer" .Net code for the certification of WeChat public platform development. Interested friends can refer to

.Net to realize the development of WeChat public service platform. Certification, certification to become a developer, the specific content is as follows

These codes will be used once when starting the certification, and will not be used in the future:

const string Token = "XXXXX";//你的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(); 
  } 
}    
 
/// <summary> 
/// 驗證微信簽名 
/// </summary> 
/// * 將token、timestamp、nonce三個參數(shù)進(jìn)行字典序排序 
/// * 將三個參數(shù)字符串拼接成一個字符串進(jìn)行sha1加密 
/// * 開發(fā)者獲得加密后的字符串可與signature對比,標(biāo)識該請求來源于微信。 
/// <returns></returns> 
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);   //字典排序 
  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"].ToString(); 
  if (CheckSignature()) 
  { 
    if (!string.IsNullOrEmpty(echoStr)) 
    { 
      Response.Write(echoStr); 
      Response.End(); 
    } 
  } 
}    
 
/// <summary> 
/// 寫日志(用于跟蹤) 
/// </summary> 
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 is the detailed content of .Net development WeChat public platform certification 'become a developer' example detailed explanation. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1488
72
Share several .NET open source AI and LLM related project frameworks Share several .NET open source AI and LLM related project frameworks May 06, 2024 pm 04:43 PM

The development of artificial intelligence (AI) technologies is in full swing today, and they have shown great potential and influence in various fields. Today Dayao will share with you 4 .NET open source AI model LLM related project frameworks, hoping to provide you with some reference. https://github.com/YSGStudyHards/DotNetGuide/blob/main/docs/DotNet/DotNetProjectPicks.mdSemanticKernelSemanticKernel is an open source software development kit (SDK) designed to integrate large language models (LLM) such as OpenAI, Azure

What are the employment prospects of C#? What are the employment prospects of C#? Oct 19, 2023 am 11:02 AM

Whether you are a beginner or an experienced professional, mastering C# will pave the way for your career.

.NET Core Quick Start Tutorial 1. The beginning: Talking about .NET Core .NET Core Quick Start Tutorial 1. The beginning: Talking about .NET Core May 07, 2025 pm 04:54 PM

1. The Origin of .NETCore When talking about .NETCore, we must not mention its predecessor .NET. Java was in the limelight at that time, and Microsoft also favored Java. The Java virtual machine on the Windows platform was developed by Microsoft based on JVM standards. It is said to be the best performance Java virtual machine at that time. However, Microsoft has its own little abacus, trying to bundle Java with the Windows platform and add some Windows-specific features. Sun's dissatisfaction with this led to a breakdown of the relationship between the two parties, and Microsoft then launched .NET. .NET has borrowed many features of Java since its inception and gradually surpassed Java in language features and form development. Java in version 1.6

C# .NET: Building Applications with the .NET Ecosystem C# .NET: Building Applications with the .NET Ecosystem Apr 27, 2025 am 12:12 AM

How to build applications using .NET? Building applications using .NET can be achieved through the following steps: 1) Understand the basics of .NET, including C# language and cross-platform development support; 2) Learn core concepts such as components and working principles of the .NET ecosystem; 3) Master basic and advanced usage, from simple console applications to complex WebAPIs and database operations; 4) Be familiar with common errors and debugging techniques, such as configuration and database connection issues; 5) Application performance optimization and best practices, such as asynchronous programming and caching.

From Web to Desktop: The Versatility of C# .NET From Web to Desktop: The Versatility of C# .NET Apr 15, 2025 am 12:07 AM

C#.NETisversatileforbothwebanddesktopdevelopment.1)Forweb,useASP.NETfordynamicapplications.2)Fordesktop,employWindowsFormsorWPFforrichinterfaces.3)UseXamarinforcross-platformdevelopment,enablingcodesharingacrossWindows,macOS,Linux,andmobiledevices.

C# .NET: Exploring Core Concepts and Programming Fundamentals C# .NET: Exploring Core Concepts and Programming Fundamentals Apr 10, 2025 am 09:32 AM

C# is a modern, object-oriented programming language developed by Microsoft and as part of the .NET framework. 1.C# supports object-oriented programming (OOP), including encapsulation, inheritance and polymorphism. 2. Asynchronous programming in C# is implemented through async and await keywords to improve application responsiveness. 3. Use LINQ to process data collections concisely. 4. Common errors include null reference exceptions and index out-of-range exceptions. Debugging skills include using a debugger and exception handling. 5. Performance optimization includes using StringBuilder and avoiding unnecessary packing and unboxing.

Deploying C# .NET Applications to Azure/AWS: A Step-by-Step Guide Deploying C# .NET Applications to Azure/AWS: A Step-by-Step Guide Apr 23, 2025 am 12:06 AM

How to deploy a C# .NET app to Azure or AWS? The answer is to use AzureAppService and AWSElasticBeanstalk. 1. On Azure, automate deployment using AzureAppService and AzurePipelines. 2. On AWS, use Amazon ElasticBeanstalk and AWSLambda to implement deployment and serverless compute.

C# as a Versatile .NET Language: Applications and Examples C# as a Versatile .NET Language: Applications and Examples Apr 26, 2025 am 12:26 AM

C# is widely used in enterprise-level applications, game development, mobile applications and web development. 1) In enterprise-level applications, C# is often used for ASP.NETCore to develop WebAPI. 2) In game development, C# is combined with the Unity engine to realize role control and other functions. 3) C# supports polymorphism and asynchronous programming to improve code flexibility and application performance.

See all articles