# WeiXinSDK **Repository Path**: loogn/WeiXinSDK ## Basic Information - **Project Name**: WeiXinSDK - **Description**: 微信SDK - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 47 - **Forks**: 40 - **Created**: 2014-06-06 - **Last Updated**: 2025-06-11 ## Categories & Tags **Categories**: weixin-dev **Tags**: None ## README weixinsdk ========= //作者联系方法: //email:loogn_0707@126.com //QQ群:153725186 //支付宝:loogn2012@gmail.com (开源免费,欢迎资助~) 微信公开帐号接口 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.OnReceiveMsgEvent += new WeiXin.ReceiveMsg(WeiXin_OnReceiveMsgEvent); WeiXin.RegisterMsgHandler(msg => { return new ReplyTextMsg { Content = "你说:" + msg.Content }; }); WeiXin.RegisterEventHandler(msg => { return new ReplyTextMsg { Content = "谢谢关注!" }; }); } //消息通知事件处理处理程序 static void WeiXin_OnReceiveMsgEvent(string xml,Dictionary dict) { if (dict.ContainsKey("Event")) { } else if (dict.ContainsKey("MsgId")) { } } public bool IsReusable { get { return false; } } }