Hi guys,
Here is code to allow max json value (you might need in some case)
var jsResult = Json(dataResponse, JsonRequestBehavior.AllowGet);
jsResult.MaxJsonLength = int.MaxValue;
return
jsResult;
-
Configuration of Routing in Web API services:
In order to enable API routing like this one:
[Route("api/Person/AddPerson")]
public HttpResponseMessage AddPerson(Person person)
{
}
floowing settings are required:
1. In WebAPIConfig
public static class WebApiConfig
{
public static void
Register(HttpConfiguration config)
{
//// Web API routes
config.MapHttpAttributeRoutes();
}
2. Need refers of System.Web.Cors
3. In global.asx.cs
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
//WebApiConfig.Register(GlobalConfiguration.Configuration);
GlobalConfiguration.Configure(WebApiConfig.Register);
}
No comments:
Post a Comment