关于 ashx 的设计
000000000000000000
可以将多个操作/方法放到一个ashx文件中,这样便于管理
以下代码参考:
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Buffer = true; context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); context.Response.AddHeader("pragma", "no-cache"); context.Response.AddHeader("cache-control", ""); context.Response.CacheControl = "no-cache"; try { if (HttpContext.Current.Request["cmd"] != null) { string cmd = HttpContext.Current.Request["cmd"]; var method = this.GetType().GetMethod(cmd); if (method != null) { method.Invoke(this, new object[] { context }); } } } catch (Exception ex) { } } public void Add(HttpContext context) { //相关业务 } public bool IsReusable { get { return false; } }
fffffffffffffffff
test red font.