Multiple Html.AntiForgeryToken (inside an HTML table)
In my view I have a loop to render a list of users:

    foreach (var user in Model.Users.Collection)
    {}

One of the columns of this table is an input button, to perform some action to a specific user. The input button does a POST request to an action method.

I'd like to protect this with **Html.AntiForgeryToken**. However, each table row has an **Html.BeginForm** with an 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 I proceed about this? Render multiple Html.AntiForgeryToken one for each Html.BeginForm? Is it correct to do this?

Thanks

Multiple Html.AntiForgeryToken (inside an HTML table)
===

In my view I have a loop to render a list of users:

    foreach (var user in Model.Users.Collection)
    {}

One of the columns of this table is an input button, to perform some action to a specific user. The input button does a POST request to an action method.

I'd like to protect this with **Html.AntiForgeryToken**. However, each table row has an **Html.BeginForm** with an 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 I proceed about this? Render multiple Html.AntiForgeryToken one for each Html.BeginForm? Is it correct to do this?

Thanks
