Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6718425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:58:04+00:00 2026-05-26T08:58:04+00:00

@using (Html.BeginForm(Index, Checkout, FormMethod.Post)) { @Html.AntiForgeryToken(App.WebUI.Helpers.SecurityHelpers.AntiforgeryTokenSalt) <input type=hidden name=amount value=@Model.PackageCost/> <input type=hidden name=currency value=$/>

  • 0
@using (Html.BeginForm("Index", "Checkout", FormMethod.Post))
{   
    @Html.AntiForgeryToken(App.WebUI.Helpers.SecurityHelpers.AntiforgeryTokenSalt)
    <input type="hidden" name="amount" value="@Model.PackageCost"/>
    <input type="hidden" name="currency" value="$"/>
    <input type="hidden" name="itemdescription" value="@Model.PackageDescriptor"/>
    <input type="hidden" name="type" value="digital"/>

    <input type="submit" value="Confirmar" class="btn primary frmsubmit" />
}

I’m POSTing this form to the Checkout controller:

public class CheckoutController : Controller
{
    [HttpPost]
    [ValidateAntiForgeryToken(Salt = SecurityHelpers.AntiforgeryTokenSalt)]
    public ActionResult Index(decimal amount, string currency, string itemDescription, string type)
    { 
        //Magic here.

Both the salt in the Form, and in the Controller are the same.

public static class SecurityHelpers
{
    public const string AntiforgeryTokenSalt = "tokenFooYouTolkienBladeRunner";
}

I’m under the impression that this would prevent a user from changing a hidden value in the form using Firebug and submitting that. ie. Buying a TV for 2$.

Yet, I can change the values using Firebug and submit it, and it goes through fine.

What am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:58:04+00:00Added an answer on May 26, 2026 at 8:58 am

    You are missing the entire point of the anti forgery token. It’s meant to block CSRF attacks, not a user changing form data on your own site. Besides, you shouldn’t be retrieving the price of an item from form data unless you intend to allow it to be provided by the customer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<%using (Html.BeginForm(OrderDevice, ImportXML, FormMethod.Post)) { %> <table id=OrderDevices class=data-table> <tr> <th> DeviceId </th> <th>
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
I am using Html.CheckBox() . The resulting HTML is: <input id=IsMultiGraph name=IsMultiGraph value=true type=checkbox>
I have an Index.cshtml view: @model AttendenceModel @{ Layout = ~/Views/Shared/_Layout.cshtml; } @using (Html.BeginForm(VisOppsummering,
I have a form like below:- <% using ( Html.BeginForm(search, home, FormMethod.Get) ) {
<% using (Html.BeginForm() { %> <%=Html.DropDownList(TopItemsList, ViewData[ListData], new { onchange=[???] })%> <% } %>
I have the following in my view: <%using (Html.BeginForm()) {%> <% foreach (var item
Code: <% using (Ajax.BeginForm(GetResourcesByProject, CreateRequest, new AjaxOptions { UpdateTargetId = ResourceListDiv})) { Response.Write(Html.DropDownList(SelectProject, Model.ProjectList,
Suppose I have the following within a webpage <% using (Html.BeginForm(ShowData, Summary)) %> <%
Using MVC, I have an html form helper in my view: using (Html.BeginForm(ActionOne, ControllerOne))

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.