Fix: Request blocked while sending JsonResult from MVC Action method

So this happened when I tried to use the return JsonResult from one of my action method.

"This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet."

Here is how you need to return your JsonResult response.

return Json(new { Id = "someid" }, JsonRequestBehavior.AllowGet);

Hope this helps.

Thanks.

There is already an open DataReader associated with this Command which must be closed first

Last week, I deployed one of the Web API website that uses Entity Framework to production server. In the publish wizard, I generated database connection string for production so that it'll connect to production database when deployed. To my surprise, few API calls resulted in an error :

System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.

Yup, the solution was to include MultipleActiveResultSets=True; in connection string. In fact, this was there in the connection string of my development database but show how not included while generating connection string of production database.

Hope this helps.