_RequestTokenVerification不存在 [英] _RequestTokenVerification not present
问题描述
你好,
我正在解决Antiforgery的问题__RequestTokenVerification不存在。
不是在页面或应用程序中获取此异常。
但是使用zap工具并运行它我可以在事件查看器中看到异常。
我在我的控制器中使用了[HttpZPost],[ValidateAntiForgeryToken]属性,并在所有视图窗体中使用@ Html.AntiforgeryToken()。
使用jQuery和ajax调用将数据发送到服务器
$。fn.executeCommand = function (命令,操作){
$( this )。each( function (){
$( this )。click( function (){
action = action || $( this )。data( )|| $( this )。attr(' href'跨度>);
var form = $( < form method ='post'action =' + action + '>< input type = 'hidden'name ='CommandName'value =' + command + '>< / form>)。appendTo($( body));
$(' < input />')。attr( ' type',' hidden')
.attr(' name', __ RequestVerificationToken)
.attr(' value',$(' #__ AjaxAntiForgeryForm输入[name = __ RequestVerificationToken]')。val())
.appendTo(form);
form.submit();
return false ;
});
});
};
请帮忙解决一下。
问候
sarfaraz
.fn.executeCommand = function (命令,操作){
( this )。each( function (){
( this )。click( function (){
action = action ||
Hello,
I am going through problem with Antiforgery __RequestTokenVerification not Present.
Am not getting this exception on the page or in application.
But using zap tool and run it i can see the exception in the event viewer.
I have use the attribute [HttpZPost], [ValidateAntiForgeryToken] in my controller and use the @Html.AntiforgeryToken() in all the view forms.
using jQuery and ajax call send data to server
$.fn.executeCommand = function(command, action) {
$(this).each(function() {
$(this).click(function() {
action = action || $(this).data("action") || $(this).attr('href');
var form = $("<form method='post' action='" + action + "'><input type='hidden' name='CommandName' value='" + command + "'></form>").appendTo($("body"));
$('<input />').attr('type', 'hidden')
.attr('name', "__RequestVerificationToken")
.attr('value', $('#__AjaxAntiForgeryForm input[name=__RequestVerificationToken]').val())
.appendTo(form);
form.submit();
return false;
});
});
};
Please help out how to resolve it.
Regards
sarfaraz
.fn.executeCommand = function(command, action) {
(this).each(function() {
(this).click(function() { action = action ||
这篇关于_RequestTokenVerification不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!