in webapi jsonrequestbehaviour is not working , showing cannot convert 'System.Web.Mvc.JsonRequestBehavior' to 'Newtonsoft.Json.JsonSerializerSettings'
code
public ActionResult AddTemprature(string EmployeeName, int EmployeeId, string Location)
{
try
{
using (EmployeeDBEntities DB = new EmployeeDBEntities())
{
WebApi.Employee emp = new WebApi.Employee();
// EmployeeModel Emp = new EmployeeModel();
emp.EmpName = EmployeeName;
emp.EmpId = EmployeeId;
emp.EmpLocation = Location;
DB.Employees.Add(emp);
DB.SaveChanges();
return Json(true, JsonRequestBehavior.AllowGet);
}
}
catch (Exception Ex)
{
}
return Json(false, JsonRequestBehavior.AllowGet);
}
Jsonwhen it should be looking to the controller for it's Json methodJsonis the pure ASP.NET MVC version of Json. Have you found out whereJsonis defined?? There must be a reason why yourJsonmethod acceptsJsonSerializerSettingsand not the normalJsonRequestBehaviourprotected internal JsonResult Json(object data, JsonRequestBehavior behavior);