asp.net - Security Error Using jQuery to POST Data Models to MVC4 -


i have mvc4 controller following signature:

[httppost] public jsonresult submitpage(pagesubmissionmodel model) {    ...    return json(result); } 

where return model either simple model:

public class page  {     public guid pageid { get; set; }     public guid surveyid { get; set; }     public int pageno { get; set; }     public string title { get; set; }     public string introduction { get; set; } } 

or json encoded url string:

return json(new {         redirectto = url.routeurl(route.routename, route.routevalues) }); 

this controller called client using following jquery method:

ajaxpost: function (responsedata, callback) {     $.ajax({         type: "post",         url: ""/surveys/ajax/submitpage",         data: json.stringify(data),         datatype: "json",         contenttype: "application/json; charset=utf-8",         cache: false,         success: function (data) {             if (typeof callback === 'function') {                 callback(data);             }         },         error: function (xmlhttprequest, errormessage, exception) {             var msg = "problem calling " + url + "()\r\n" + errormessage;             alert(msg);         }     }); } 

where data argument javascript object constructed follows:

responsedata = {     surveyresponseid: 23,     subscriberresponseid: 47,     pageid: 1,     responses: [         {id: 24, value: "tom" },         ....     ]   }; 

when run code following server error:

this request has been blocked because sensitive information disclosed third party web sites when used in request

researching error (http://haacked.com/archive/2009/06/25/json-hijacking.aspx) confused because, far can see, , born out fiddler, client posting javascript model don't see why server throwing request error. in addition, controller marked [httppost] attribute.

if can appreciated.

please try code below

[httppost] public jsonresult submitpage(pagesubmissionmodel model) {    ...    return json(result,jsonrequestbehavior.allowget); } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -