企业微信验证数据签名请求

 1 string signature = Request["signature"];
 2 string timestamp = Request["timestamp"];
 3 string nonce     = Request["nonce"];
 4 
 5 List<string> list = new List<string>();
 6 
 7 list.Add(appToken);
 8 list.Add(timestamp);
 9 list.Add(nonce);
10 
11 list.Sort();
12 
13 StringBuilder sb = new StringBuilder();
14 foreach(string s in list)
15    sb.Append(s);
16 
17 if(signature.ToUpper() != System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sb.ToString(),"SHA1"))
18    HttpContext.Current.Response.Write("非法的验证");
19 else
20    HttpContext.Current.Response.Write(Request["echostr"]);

 

posted @ 2014-11-07 17:46  star丶清影  阅读(973)  评论(0编辑  收藏  举报