asp.net 如何主动调用微信企业号接口,发送文本消息 asp.net微信企业号 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/wuhuacong/p/3995494.html这篇博文看懂了一半,就是不知该如何运用到.net2003的代码里 文章讲的是用C#开发微信企业公众号的接口你是想调用这个接口去发消息那就调用发消息的那个web服务就可以了C#调用WebService,搜索这个 找找官网上相关教程的,下面是简要代码: public static void DoSendText(string access_token, string touser, string content) { Uri u = new Uri(string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}" , access_token)); SendRequest(u, ToJson(content)); } public static string ToJson<T>(string content) { // 生成 "text"="xxx" 的JSON } private static void SendRequest(Uri uri, string p) { string res = CodeNet.SendRequest(uri, p); if (res.Length > 0) { //CheckError(res); } } public static string SendRequest(Uri uri, string body) { WebClient wc = new WebClient(); Encoding enc = Encoding.UTF8; return enc.GetString(wc.UploadData(uri, enc.GetBytes(body))); } HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);request.Method = “POST”;byte[] bytes = Encoding.Default.GetBytes(requestData);request.ContentLength = bytes.Length;using (Stream stream = request.GetRequestStream()) { stream.Write(bytes, 0, bytes.Length); }using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { StreamReader reader = new StreamReader(response.GetResponseStream()); string content = reader.ReadToEnd();} 在asp.net中在某个事件发生后如何去调用相应事件的结果 正则表达式难题!!!!!!! asp.net打包部署问题(急) 求一个数学上的算法,用程序怎么写, 读取数据库信息显示在表格中的问题 求助关于数据录入时子条目编辑的问题 在利用动网论坛模板做论坛时,应注意哪些问题?请大家各抒已见,高分答谢,来者有分 谈出窗口!! asp.net如何调用放在服务器上的应用程序(.exe)? 页面的最大化??? MVC链接问题 gridview中服务器标记的格式不正确
这篇博文看懂了一半,就是不知该如何运用到.net2003的代码里
你是想调用这个接口去发消息
那就调用发消息的那个web服务就可以了
C#调用WebService,搜索这个
{
Uri u = new Uri(string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"
, access_token)); SendRequest(u, ToJson(content));
} public static string ToJson<T>(string content)
{
// 生成 "text"="xxx" 的JSON
} private static void SendRequest(Uri uri, string p)
{
string res = CodeNet.SendRequest(uri, p);
if (res.Length > 0)
{
//CheckError(res);
}
} public static string SendRequest(Uri uri, string body)
{
WebClient wc = new WebClient();
Encoding enc = Encoding.UTF8;
return enc.GetString(wc.UploadData(uri, enc.GetBytes(body)));
}
request.Method = “POST”;byte[] bytes = Encoding.Default.GetBytes(requestData);
request.ContentLength = bytes.Length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(bytes, 0, bytes.Length);
}using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string content = reader.ReadToEnd();
}