asp.net mvc - Does the AntiForgeryToken need to be inside a form tag -


all examples see have seen, have antiforgerytoken inside of <form> tag:

@using html.beginform("dothis", "fromhere", formmethod.post, new {.id = "myid"})     @html.antiforgerytoken() end using 

is required? doing posts server using ajax/jquery calls. i'm using example provided here (prefilter) can retrieve antiforgerytoken. don't have antyforgerytoken inside of form tag. placed on root _layout page , called good. why need else? can't think of why have to...

in examples have anti-forgery within form tag, when form posted via submit button click automatically posted of other form variables. if manually posting data via ajax can have anti-forgery token generated anywhere, need grab value , post along other data sending server.

make sure name property of anti-forgery token same html helper method ("__requestverificationtoken").


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -