微信开发.Net 接入示例
来源:互联网 发布:小米任我行 联通网络 编辑:程序博客网 时间:2024/06/07 18:49
<%@ Page Language="C#" %><script runat="Server" > //此处TOKEN可以自行修改 public const String TOKEN = "weixin_kevinlc"; private void Page_Load(object sender, EventArgs e) { String echoStr = Request["echostr"]; if(this.checkSignature()){ Response.Write(echoStr); } } //验证 private bool checkSignature(){ string signature = Request["signature"]; string timestamp = Request["timestamp"]; string nonce = Request["nonce"]; string token = TOKEN;string[] tmpArr = new string[]{token, timestamp, nonce}; Array.Sort(tmpArr);string tmpStr = string.Join("",tmpArr); //sha1加密 System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] secArr = sha1.ComputeHash(System.Text.Encoding.Default.GetBytes(tmpStr)); tmpStr = BitConverter.ToString(secArr).Replace("-","").ToLower();if( tmpStr == signature ){return true;}else{return false;} }</script>
摘要: .Net 接入微信 示例代码
微信公众平台接口开发官方仅提供了 PHP 接入示例代码, 网上找到的.Net代码多半需要积分下载,
所以自己写了一个
如下:
将以上代码 另存 为 wx_sample.aspx
上传到你的服务器
填写当前页面访问路径, 填写对应的TOKEN
https://mp.weixin.qq.com/
0 0
- 微信开发.Net 接入示例
- 微信开发接入
- 微信开发-接入
- .net mvc 微信开发笔记(二)------网址接入
- asp.net微信开发第一篇----开发者接入
- 微信开发 接入参数
- 微信开发【基本接入】
- 微信接入自定义开发
- 微信开发接入代码
- 微信开发:接入微信入口
- JAVA微信开发-新手接入指南
- 微信公众账号开发模式接入
- JAVA微信开发-新手接入指南
- JAVA微信开发-新手接入指南
- 微信公众号开发之接入
- 微信公众号开发接入指南
- 微信学习_02_开发模式接入
- Android接入微信开发注意事项
- Apache Mina(二)
- caffe的二分类微调,制作train.txt,val.txt
- 腾讯Bugly热更新集成总结
- SpringMVC multipart文件上传详细教程之三:视图及运行结果
- 【数组】Leetcode编程题解:215. Kth Largest Element in an Array Add to List
- 微信开发.Net 接入示例
- The battery cannot be identified the system will be unable to charge this battery
- JSP 九大隐式对象及其out对象
- MyBatis Generator generatorConfig.xml配置详解
- sox 获取wav文件的时长
- jquery 数值输入框实现
- C#设计模式--装饰器模式
- “没拿到一毛钱股份的老公”刷爆朋友圈 吃瓜群众雾里看花
- webview同步cookies