public partial class MPVerify : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { var echostr = Request.QueryString["echostr"].ToString(); if (Verify()) { Response.Write(echostr); Response.End(); } else { Response.End(); } } private bool Verify() { var signature = Request.QueryString["signature"].ToString(); var timestamp = Request.QueryString["timestamp"].ToString(); var nonce = Request.QueryString["nonce"].ToString(); var token = "yy2056"; string[] ArrTmp = { token, timestamp, nonce }; Array.Sort(ArrTmp); //字典排序 string tmpStr = string.Join("", ArrTmp); tmpStr = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tmpStr, "SHA1"); tmpStr = tmpStr.ToLower(); if (tmpStr == signature) { return true; } else { return false; } } }