Udostępnij za pośrednictwem


JsonRequestBehavior.AllowGet Not Working?

Today, I got the following error:

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.

When I looked in my controller, I found:

return Json(response, JsonRequestBehavior.AllowGet);

That's strange...

A quick run of the debugger revealed the issue: an exception was being thrown!  So, if JsonRequestBehavior.AllowGet seems to not be working, first check to make sure your code isn't throwing an exception!