Export (0) Print
Expand All

HtmlHelper.AntiForgeryToken Method

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

public string AntiForgeryToken()

Return Value

Type: System.String
The generated form field (anti-forgery token).

The anti-forgery token can be used to help protect your application against cross-site request forgery. To use this feature, call the AntiForgeryToken method from within your form, and add the ValidateAntiForgeryTokenAttribute to the action method you want to protect.

Community Additions

Show:
© 2014 Microsoft