public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json";// string Name = context.Request.QueryString["Name"].ToString(); int UniversityId = Convert.ToInt32(context.Request.QueryString["University"]); string Des = context.Request.QueryString["Des"].ToString(); if (Name.Length >= 1 && UniversityId != 0) { try { College college = new College(); college.Name = Name; college.UniversityID = UniversityId; college.Des = Des; college.DateCreated = DateTime.Now; college.Save(); context.Response.Write("{success:true,msg:'新增成功。',DateCreated:'" + DateTime.Now.ToShortDateString() + "',collegeId:'" + college.Id + "'}"); } catch (Exception ex) { context.Response.Write("{success:false,msg:'" + ex.Message + "'}"); } } else { context.Response.Write("{success:false,msg:'新增失败,名称和学校为必填项。'}"); } }