The view context object (ViewContext) is available in the view components (which will be discussed in Chapter 9, Reusable Components) and as a property of Razor Pages (IRazorPage), meaning you can access it in views. In it, besides the usual context properties (such as HttpContext, ModelStateDictionary, RouteData, and ActionDescriptor), you also have access to the form context (FormContext) object. This object offers the following properties:
- CanRenderAtEndOfForm (bool): Indicates whether the form can render additional content (EndOfFormContent) at the end.
- EndOfFormContent (IList<IHtmlContent>): A collection of content to add at the end of the form (before the </form> tag).
- FormData (IDictionary<string, object>): The submitted form data.
- HasAntiforgeryToken (bool): Indicates whether the form is rendering the anti-forgery token, which depends on how the BeginForm method was called. The default...