Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loogn/WeiXinSDK
微信公开帐号接口
https://github.com/loogn/WeiXinSDK
Last synced: 3 months ago
JSON representation
微信公开帐号接口
- Host: GitHub
- URL: https://github.com/loogn/WeiXinSDK
- Owner: loogn
- Created: 2014-01-23T02:21:52.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T06:30:12.000Z (over 7 years ago)
- Last Synced: 2024-01-15T23:39:40.899Z (5 months ago)
- Language: C#
- Size: 84 KB
- Stars: 22
- Watchers: 6
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-stars - WeiXinSDK - 微信公开帐号接口 (C#)
README
weixinsdk
=========
//由于github在国内访问不便,源码已移到 http://git.oschina.net/loogn/WeiXinSDK
微信公开帐号接口
public class WeiXinUrl : IHttpHandler
{
static string token = "token";
static string AppId = "AppId";
static string AppSecret = "AppSecret";
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
var signature = context.Request["signature"] ?? string.Empty;
var timestamp = context.Request["timestamp"] ?? string.Empty;
var nonce = context.Request["nonce"] ?? string.Empty;
//var echostr = context.Request.QueryString["echostr"] ?? string.Empty;
if (WeiXin.CheckSignature(signature, timestamp, nonce, token))
{
//context.Response.Write(echostr);
var replyMsg = WeiXin.ReplyMsg().GetXML();
context.Response.Write(replyMsg);
}
else
{
context.Response.Write("fuck you");
}}
static WeiXinUrl()
{
WeiXin.ConfigGlobalCredential(AppId, AppSecret);
WeiXin.RegisterMsgHandler(msg =>
{
return new ReplyTextMsg { Content = "你说:" + msg.Content };
});WeiXin.RegisterEventHandler(msg =>
{
return new ReplyTextMsg { Content = "谢谢关注!" };
});
}public bool IsReusable
{
get
{
return false;
}
}
}