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

微信公开帐号接口

Lists

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;
}
}
}