This is a migrated thread and some comments may be shown as answers.

[Solved] How to I apply antiforgerytoken to ajaxrequest assoicated with mvc telerik window

0 Answers 63 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steven
Top achievements
Rank 1
Steven asked on 20 Mar 2013, 05:55 AM

I am using the ajaxRequest client side api to reload the LoadContentFrom extentsion of the Telerik window. When I call the ajaxRequest I get error 404

http://localhost:53607/SystemView/AlarmReport?__RequestVerificationToken=O…uE0TFqcp%2BkwrKxUrSG0BclXcI59gWMSuAKhBlou5KJeevihhP0Hh0h91&_=1363758449350

I have tired passing the placing  the antiforgerytoken value in the ajaxRequest method as a parameter , and placing it in the method.  Either way the error 404 appear with the similar error being displayed.

 

    function onClickAlarmByType(x, index, alarmTypeId) {

        var window = $('#alarm_by_type_window');

        var twindow = $('#alarm_by_type_window').data('tWindow');

        twindow.ajaxRequest("/SystemView/AlarmReport", { __RequestVerificationToken: getAntiForgeryToken().value });

 

I have also added the

<%=Html.AntiForgeryToken(CommandCenter.Security.Constants.AntiForgeryTokenSalt) %>

above the telerik window and the error 404 still occurs

<%=Html.AntiForgeryToken(CommandCenter.Security.Constants.AntiForgeryTokenSalt) %>

    <%= Html.Telerik().Window()

                    .Name("alarm_by_type_window")

                    .Buttons(buttons => buttons.Close())

                    .Draggable(true)

                    .Resizable()

                    .Modal(false)

                    .Width(325)

                    .Height(325)

                    .Title("Alarm ByTypeReports")                                                       

                    .Visible(false)

                    .Effects(fx => fx.Expand())

                    .LoadContentFrom("AlarmReport", "SystemView")

               

    %>

 

I spent like 3 hours on Telerik forums and the internet and have found no solution. Most of the examples show in Telerik demo are what I call piss ass examples and when it get to real application where 95 percent of Telerik extension controls throw problems there is usually no answer suggesting it. What do I have to so the action method on the server will be called when calling the client side ajaxRequest method on the telerik window?
Tags
General Discussions
Asked by
Steven
Top achievements
Rank 1
Share this question
or