public class ETPOST : IHttpHandler, System.Web.SessionState.IReadOnlySessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Buffer = true; context.Session.LCID = 2052; //中国地区LCID context.Response.Charset = "utf-8"; //设置入库编码 if (string.IsNullOrEmpty(context.Request.Form["title"]) || string.IsNullOrEmpty(context.Request.Form["content"])) return; //若标题或内容其中一个为空,则认为此条信息无效 var newsModel = new NewsModel { Summury = context.Request.Form["summury"], Title = context.Request.Form["title"], Content = context.Request.Form["content"], Thumbnail = context.Request.Form["thumbnail"], Category = context.Request.Form["category"] != null ? Convert.ToInt32(context.Request.Form["category"]) : -1, Author = context.Request.Form["author"], Source = context.Request["source"], OriginalPath = context.Request.Form["originalPath"], IsHot = context.Request.Form["isHot"] != null ? Convert.ToBoolean(context.Request.Form["isHot"]) : false, IsHeadline = context.Request.Form["isHeadline"] != null ? Convert.ToBoolean(context.Request.Form["isHeadline"]) : false, Keyword = context.Request.Form["keyword"], }; if (BLL.News.InsertNews(newsModel, 1)) context.Response.Write("[ok]"); }