资源简介
微信公众号开发.NET源码亲测可用,修改Web.config文件的 和interfaceTest.ashx文件的const string token = "token值";然后发布放到服务器上,微信公众测试号上输入服务器URL(http://***/interfaceTest.ashx)和token值,提交成功后扫描测试号二维码,自动回复“谢谢关注微信01”,适合初学者

代码片段和文件信息
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.xml;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Net;
namespace weixin_api
{
public partial class createMenu : System.Web.UI.Page
{
protected void Page_Load(object sender EventArgs e)
{
FileStream fs1 = new FileStream(Server.MapPath(“.“)+“\\menu.txt“ FileMode.Open);
StreamReader sr = new StreamReader(fs1 Encoding.GetEncoding(“GBK“));
string menu = sr.ReadToEnd();
sr.Close();
fs1.Close();
GetPage(“https://api.weixin.qq.com/cgi-bin/menu/create?access_token=access_token“ menu);
}
public string GetPage(string posturl string postData)
{
Stream outstream = null;
Stream instream = null;
StreamReader sr = null;
HttpWebResponse response = null;
HttpWebRequest request = null;
Encoding encoding = Encoding.UTF8;
byte[] data = encoding.GetBytes(postData);
// 准备请求...
try
{
// 设置参数
request = WebRequest.Create(posturl) as HttpWebRequest;
CookieContainer cookieContainer = new CookieContainer();
request.CookieContainer = cookieContainer;
request.AllowAutoRedirect = true;
request.Method = “POST“;
request.ContentType = “application/x-www-form-urlencoded“;
request.ContentLength = data.Length;
outstream = request.GetRequestStream();
outstream.Write(data 0 data.Length);
outstream.Close();
//发送请求并获取相应回应数据
response = request.GetResponse() as HttpWebResponse;
//直到request.GetResponse()程序才开始向目标网页发送Post请求
instream = response.GetResponseStream();
sr = new StreamReader(instream encoding);
//返回结果网页(html)代码
string content = sr.ReadToEnd();
string err = string.Empty;
Response.Write(content);
return content;
}
catch (Exception ex)
{
string err = ex.Message;
return string.Empty;
}
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 436224 2015-08-24 14:05 weixin_api\weixin_api\bin\Newtonsoft.Json.dll
文件 504032 2015-08-24 14:05 weixin_api\weixin_api\bin\Newtonsoft.Json.xm
文件 16384 2017-09-12 16:56 weixin_api\weixin_api\bin\weixin_api.dll
文件 46592 2017-09-12 16:56 weixin_api\weixin_api\bin\weixin_api.pdb
文件 2486 2017-09-12 13:54 weixin_api\weixin_api\Common\CommonMethod.cs
文件 2740 2017-09-12 13:36 weixin_api\weixin_api\Common\HttpGetPost.cs
文件 966 2017-09-12 13:35 weixin_api\weixin_api\Common\Json
文件 418 2017-09-12 13:26 weixin_api\weixin_api\Common\tokenInfo.cs
文件 372 2017-09-12 13:35 weixin_api\weixin_api\Common\WeixinUrl.cs
文件 449 2014-03-26 13:52 weixin_api\weixin_api\createMenu.aspx
文件 2739 2014-03-26 14:54 weixin_api\weixin_api\createMenu.aspx.cs
文件 808 2014-03-26 13:52 weixin_api\weixin_api\createMenu.aspx.designer.cs
文件 104 2014-03-26 13:53 weixin_api\weixin_api\interfaceTest.ashx
文件 5698 2017-09-14 14:45 weixin_api\weixin_api\interfaceTest.ashx.cs
文件 734 2014-03-26 16:02 weixin_api\weixin_api\menu.txt
文件 7420 2017-09-12 16:56 weixin_api\weixin_api\messageHelp.cs
文件 7029 2017-09-14 14:44 weixin_api\weixin_api\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 436224 2015-08-24 14:05 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\bin\Newtonsoft.Json.dll
文件 504032 2015-08-24 14:05 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\bin\Newtonsoft.Json.xm
文件 16384 2017-09-12 16:56 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\bin\weixin_api.dll
文件 46592 2017-09-12 16:56 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\bin\weixin_api.pdb
文件 449 2014-03-26 13:52 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\createMenu.aspx
文件 104 2014-03-26 13:53 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\interfaceTest.ashx
文件 734 2014-03-26 16:02 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\menu.txt
文件 239835 2014-03-26 13:52 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\sc
文件 168792 2014-03-26 13:52 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\sc
文件 71922 2014-03-26 13:52 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\sc
文件 449 2014-03-26 13:53 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\selectMenu.aspx
文件 7563 2017-09-12 16:00 weixin_api\weixin_api\obj\Debug\Package\PackageTmp\Web.config
文件 7567 2017-09-12 16:00 weixin_api\weixin_api\obj\Debug\TransformWebConfig\original\Web.config
............此处省略40个文件信息
相关资源
- C#唤起微信刷脸支付摄像头
- cs第三方使用微信授权登录
- 微信扫码支付、H5支付、公众号等支付
- 微信清粉工具
- 微信公众平台网页授权获取用户基本
- .net实现微信公众帐号主动发消息给用
- C#仿微信飞机大战_改版170729
- asp.net C# 新微信公众号平台源码
- .NET C# 封装微信API操作类源码
- c#微信支付、微信企业支付到个人,微
- .net core 2.2微信扫码支付
- ASP.NET微信开发包括图文上传菜单上传
- C#微信企业付款到银行卡demo真实可用
- C#最新微信Hook,基于微信3.0.0.57版本
- 扫码登录授权
- asp.net 微信支付V3.7完整可用代码和文
- Asp.Net版微信公众号开发源码Demo_90.r
- c#微信通讯的Web平台
- .NET C# API对应的SDK WxPayAPI_CS_v3 调试通
- 微信支付扫码支付asp.net C#版
- ASP.NET微信支付接口调用Demo JSAPI
- 微信现金红包asp.net c#源码支付接口
- asp.net 扫描二维码(微信)
- 可以用的微信支付.NET版
- C#.NET版微信支付API官方demo修改版
- asp.net 微信公众号开发源码
- C#支付宝、微信扫码支付类库
- C#企业微信发送文本消息,发送图片给
- C#&APP;.NET微信APP支付服务端
- asp.net微信支付接口代码
评论
共有 条评论