Thursday, October 8, 2015

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.

I was recently working on implementing some Kendo UI functionality for my ASP.NET MVC Web Application, when I encountered the following error message:






Well, as it turns out, the code sample provided on the Telerik Kendo UI Demos site, did not accommodate for this error message.

This Enumeration is documented in this MSDN article: https://msdn.microsoft.com/en-us/library/system.web.mvc.jsonrequestbehavior%28v=vs.118%29.aspx

Fortunately, after reading the error message more carefully and doing a bit of searching on Google, I was able to quickly discover that I needed to change the following line of code in my ASP.NET MVC Controller from this:
public ActionResult Customers_Read([DataSourceRequest]DataSourceRequest request)

{

    return Json(GetCustomers().ToDataSourceResult(request));

}



instead to the following code snippet:



public ActionResult Customers_Read([DataSourceRequest]DataSourceRequest request)

{

    return Json(GetCustomers().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);

}


As soon as I did that, my issue was resolved!

No comments:

Post a Comment