public void ProcessRequest(HttpContext context) { context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.ContentType = "text/json"; context.Response.Charset = "UTF-8"; string action = context.Request.Params["method"]; try { if (action == null || action == "") throw new Exception("method不能为空"); Type htype = this.GetType(); MethodInfo method = htype.GetMethod(action); if (method == null) throw new Exception("未提供此功能"); method.Invoke(this, new object[] { context }); } catch (Exception ex) { context.Response.Clear(); context.Response.Write(JsonHelper.ReturnJson(false, ex.Message, "")); } finally { context.Response.End();//处理完成,返回Response } }