Hi!
I implemented an MVC3 project with a controller that handles ajax POST requests in JSON format. The controller action requires an AntiForgeryToken.
Now I have a problem with a kendo datasource request posted to the server. I followed the samples for the dataSource configuration:
{"__RequestVerificationToken":"cVKwXnuusO7LVzfoTYk2FD4S5BhSstIULlN0uzspliMOByr/OFRMpbaeLT4i84lpqZZPuzNyUzuhqULNEA/WyljOuD17gycOs2yQGfNlHq1GrX7/QcW3l0RC30RAXA9ruyLRuvCBLNOASqsMUSBb4wIyzxMj4mLrZZNdqk4JWyo=","take":10,"skip":0,"page":1,"pageSize":10}&__RequestVerificationToken=cVKwXnuusO7LVzfoTYk2FD4S5BhSstIULlN0uzspliMOByr/OFRMpbaeLT4i84lpqZZPuzNyUzuhqULNEA/WyljOuD17gycOs2yQGfNlHq1GrX7/QcW3l0RC30RAXA9ruyLRuvCBLNOASqsMUSBb4wIyzxMj4mLrZZNdqk4JWyo=
The first __RequestVerificationToken is in JSON format, but the appended 2nd __RequestVerificationToken is not and leads to the error of the MVC service.
How can I suppress the 2nd instance?
I implemented an MVC3 project with a controller that handles ajax POST requests in JSON format. The controller action requires an AntiForgeryToken.
Now I have a problem with a kendo datasource request posted to the server. I followed the samples for the dataSource configuration:
dataSource: new kendo.data.DataSource({ type: "json", transport: { read: { url: "GetZones", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", data: { __RequestVerificationToken: $("input[name=__RequestVerificationToken]").val() } //sendAntiForgery() }, parameterMap: function (options) { return JSON.stringify(options); } }}; However in fiddler I get the following error: {"error":"Invalid JSON primitive: __RequestVerificationToken=cVKwXnuusO7LVzfoTYk2FD4S5BhSstIULlN0uzspliMOByr/OFRMpbaeLT4i84lpqZZPuzNyUzuhqULNEA/WyljOuD17gycOs2yQGfNlHq1GrX7/QcW3l0RC30RAXA9ruyLRuvCBLNOASqsMUSBb4wIyzxMj4mLrZZNdqk4JWyo=."} I found out that the token is send out twice as you can see in the following request body:
{"__RequestVerificationToken":"cVKwXnuusO7LVzfoTYk2FD4S5BhSstIULlN0uzspliMOByr/OFRMpbaeLT4i84lpqZZPuzNyUzuhqULNEA/WyljOuD17gycOs2yQGfNlHq1GrX7/QcW3l0RC30RAXA9ruyLRuvCBLNOASqsMUSBb4wIyzxMj4mLrZZNdqk4JWyo=","take":10,"skip":0,"page":1,"pageSize":10}&__RequestVerificationToken=cVKwXnuusO7LVzfoTYk2FD4S5BhSstIULlN0uzspliMOByr/OFRMpbaeLT4i84lpqZZPuzNyUzuhqULNEA/WyljOuD17gycOs2yQGfNlHq1GrX7/QcW3l0RC30RAXA9ruyLRuvCBLNOASqsMUSBb4wIyzxMj4mLrZZNdqk4JWyo=
The first __RequestVerificationToken is in JSON format, but the appended 2nd __RequestVerificationToken is not and leads to the error of the MVC service.
How can I suppress the 2nd instance?