微信接受请求的接口

using System;
using System.Web;
using WeiXin.Core;
using Framework.Core;
using Newtonsoft.Json;

namespace WeiXin
{
    public class ReceiveHttpHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            Logger.Write("request:" + context.Request.Url);
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(context.Request.Params);
            try
            {
                if (context.Request.HttpMethod.ToLower() == "get")
                {
if (context.Request.Url.Query != string.Empty)
{
    context.Response.Write(AccessTo.Validation(context));
}
else
{
    context.Response.Write("success");
}
                }
                else
                {
string msgType = string.Empty;
string XML = RequestHelper.GetFormData();
//Logger.Write("XML:"+XML);
context.Items.Add("XML", XML);//module和handler之间组织和共享数据的集合
if (XML.Contains("<xml>"))
{
    msgType = XmlHelper.XMLSelect(XML);    
}
if (SpringContainer.ContainObject(msgType))
{
    IProcess process = SpringContainer.GetObject<IProcess>(msgType);
    process.Process();
}
                }
            }
            catch (Exception ex)
            {
                Logger.Write("接受请求失败,原因:" + ex.Message);               
            }
        }

        public bool IsReusable
        {
            get { return true; }
        }
    }
}

 

微信接受请求的接口

原文:http://www.cnblogs.com/slu182/p/4257792.html

以上是微信接受请求的接口的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>