This question is locked. New answers and comments are not allowed.
Hey, I was wondering how to pass an antiforgery token whenever making an AJAX request to retrieve chart data.
For example:
I tried the method outlined here "http://www.telerik.com/community/forums/aspnet-mvc/grid/antiforgerytoken-on-insert.aspx" but ClientEvents does not have the OnSave method.
So I tried using the OnLoad method as shown here "http://www.aspnetwiki.com/page:implementing-the-anti-forgery-token-with-the-telerik-mv" but found out (through log strings) that the ajaxSend method never fires.
I also tried to modify the ajax request via jquery.ajax.prefilter(), but that did not work either.
Can anyone suggest a solution? Right now the chart data won't load unless I explicitly disable the CSRF protection set up in the controller.
For example:
@(Html.AntiForgeryToken())...
@( Html.Telerik().Chart(Model) .Name("chart") .Title("A Fancy Chart") .Series(series => { series.Line("Value"); }) .DataBinding(dataBinding => dataBinding.Ajax().Select("_LineChartData", "Home", new { datapoints = 15 })) .CategoryAxis(axis => axis .Categories(s => s.Id)) .ValueAxis(axis => axis .Numeric()) .HtmlAttributes(new { style = "width: 400px; float:left;" }) )
I tried the method outlined here "http://www.telerik.com/community/forums/aspnet-mvc/grid/antiforgerytoken-on-insert.aspx" but ClientEvents does not have the OnSave method.
So I tried using the OnLoad method as shown here "http://www.aspnetwiki.com/page:implementing-the-anti-forgery-token-with-the-telerik-mv" but found out (through log strings) that the ajaxSend method never fires.
I also tried to modify the ajax request via jquery.ajax.prefilter(), but that did not work either.
Can anyone suggest a solution? Right now the chart data won't load unless I explicitly disable the CSRF protection set up in the controller.