asp.net mvc - Multiple Html.AntiForgeryToken (inside an HTML table) -
in view have loop render list of users:
foreach (var user in model.users.collection) {}
one of columns of table input button, perform action specific user. input button post request action method.
i'd protect html.antiforgerytoken. however, each table row has html.beginform input button.
<td> <% using(html.beginform(user.isinrole ? "removeuserfromrole" : "addusertorole", "usermanagement", formmethod.post)) { %> <%: html.antiforgerytoken("addremoveuser") %> <input name="action" type="submit" value="update" /> <% } %> </td>
how should proceed this? render multiple html.antiforgerytoken 1 each html.beginform? correct this?
thanks
you use same salt value tokens.
<%: html.antiforgerytoken("some_random_string") %>
and try apply same salt on 2 controller actions posting to:
[validateantiforgerytoken(salt = "some_random_string")]
Comments
Post a Comment