1.问题现象Tomcat7+Spring4.1.4,返回json字符串时发生406错误 The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers. HTTP Status 406 - type Status report messa…
public ActionResult Index(string id)//主页 //参数string searchString 访问方式为index?searchString=xxxx .参数string id 访问方式为index/x { string searchString = id; //return View(db.Books.ToList()); //返回一个对象集合 var s = from m in db.Books select m; //查询所有数据 if (!string…
因mvc控制器返回类型JsonResult 在处理对象转JSON的时候,对日期的格式化处理并不太符合要求,所以重新继承抽象类ActionResult使用Newtonsoft.Json来系列化 using System; using System.Text; using System.Web; using System.Web.Mvc; using Newtonsoft.Json; namespace Comon { public class JsonNetResult : ActionResul…