How to enable JSON calls in my ASP.NET MVC 2 application?

I'm trying to make a dynamic chart using HighCharts, but it seems impossible to include ASP tags inside JavaScript, so I'm trying to use JSon. I followed this tutorial step by step, but when I try to load the page, I get the following message:

This request is blocked because it can be disclosed to third-party websites when it is used in a GET request. To allow GET requests, set JsonRequestBehavior for AllowGet.

So, now I'm wondering if I need to install something in Web.Configor somewhere else.

Could you guys help me?

+3
source share
1 answer

There is a fairly simple fix. In your query processing functions, where you will have:

return Json(myStuff);

Replace it with overload, which takes JsonRequestBehavior:

return Json(myStuff, JsonRequestBehavior.AllowGet);
+6
source

Source: https://habr.com/ru/post/1780299/


All Articles