Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hidden field "ufprt" being added to Razor Umbraco Form - Why?

I have got a form (below) that is posted to an umbraco surface controller.

@using (Html.BeginUmbracoForm("AddToBasket", "Basket"))
{

<h1>@Model.productSelectionModel.Product.Title - @Model.productSelectionModel.Product.Price.ToString("C")</h1>

<ul>
    @foreach (var productOption in Model.productSelectionModel.ProductOptions)
    {
        <li>@productOption.Option.Title</li>
        @Html.DropDownList(productOption.Option.Id.ToString(), productOption.ValuesInOptions.ToSelectList(f => f.OptionValue.OptionValue1, 
                                                   f => f.Id.ToString(), 
                                                   "Select"));                                             
    }
</ul>

    <input type="submit" value="Add To Basket">
}

When I look at the HTML rendered for this form it seems to have added a hidden field called ufprt. Does any one know what this is? Why is it being added, I'm not using it any where ( I don't think I am anyway)

Any ideas?

<input name='ufprt' type='hidden' value='6C01896EF3D5F430F9ED041DD2B0D31F89FA969A085C6F4FDEC3C9D4B906846E7AA80041CEA12573E9F58C1740893B770AAE3319FAA8FA35C89A54D301CFE31B85ADC0D3D9506D208DB068D1257C5F0D5F1B3B90FD59A5C2938EED0A2EB1168AD4573CD5D043D47A8F1AA789E988CC614686B89BE57D35DA8EAAA110044C393F' />
like image 435
Ayo Adesina Avatar asked Dec 15 '25 07:12

Ayo Adesina


1 Answers

It is to route the form to the correct controller/action method (Umbraco has the ability to route forms via that input value rather than the typical MVC approach of using the URL). I believe this is particular to surface controllers (i.e., it wouldn't apply to a normal controller, API controller, or RenderMvcController).

It is not a CSRF token as another answer indicates. If it were, it would likely have a name of "__RequestVerificationToken" as indicated here: http://www.asp.net/web-api/overview/security/preventing-cross-site-request-forgery-%28csrf%29-attacks

EDIT: This information has been added here: https://github.com/kgiszewski/LearnUmbraco7/blob/a97e85e5ad17e2ba9fc463f02c76885911046b57/Chapter%2006%20-%20Surface%2C%20WebAPI%20and%20RenderMVC%20Controllers/02%20-%20Surface%20Controllers.md#special-routing

like image 84
Nicholas Westby Avatar answered Dec 16 '25 23:12

Nicholas Westby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!