<%@ WebHandler Language="C#" Class="AjaxHandler" %> using System; using System.Web; public class AjaxHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string Cmd = context.Request["cmd"];//接收方法名参数 if (!string.IsNullOrEmpty(Cmd)) { System.Reflection.MethodInfo Method = this.GetType().GetMethod(Cmd, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);//通过反射机制,直接对应到相应的方法 if (Method != null) { Method.Invoke(this, new object[] { context }); } } else { context.Response.Redirect("~/Login.aspx"); } } void DelContents(HttpContext context) { string strGuid = context.Request["Guid"];//接收参数 context.Response.Write("OK"); } public bool IsReusable { get { return false; } } }
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.mushiming.com/mjsbk/13530.html