Note that there are some explanatory texts on larger screens.

plurals
  1. POAllowing Json Get without using Return(data, JsonRequestBehavior.AllowGet) (To allow GET requests, set JsonRequestBehavior to AllowGet. error)
    primarykey
    data
    text
    <p>I want to use a javascript uploader in my C# project. The javascript gets loaded in the master page, and in the partial view where I want the uploader to be I have the following code:</p> <pre><code> &lt;a class="upload" href="/Administration/blue/en-gb/Entity/StoreFile/97?Entity=Note&amp;amp;Field=File"&gt;uploadfile&lt;/a&gt; </code></pre> <p>However, when I click the button I get an '"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." error. The same kind of question can be found <a href="https://stackoverflow.com/questions/2350921/asp-net-mvc-2-failed-with-jquery-ajax-response">here</a>. However, as a solution something like the following is given:</p> <pre><code> return Json(new { mymsg = "my msg" }, JsonRequestBehavior.AllowGet); </code></pre> <p>Where adding JsonRequerstBehavior.AllowGet solves the problem. </p> <p>In my C# ActionResult that calls the PartialView in which I Want to add this I have this as a return:</p> <pre><code>return PartialView("CreateNotePartial", Model); </code></pre> <p>I also tried:</p> <pre><code>&lt;%$.post('/blag/JSON', function (data) {%&gt; &lt;a class="upload" href="/Administration/blue/en-gb/Entity/StoreFile/97?Entity=Note&amp;amp;Field=File"&gt;uploadfile &lt;/a&gt; &lt;%});%&gt; </code></pre> <p>but that did not work. </p> <p>I can not add the JsonRequestBehavior.AllowGet. How can this be made to work without this .AllowGet?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload