/// <summary> /// Generates an anti-forgery token for this request. This token can /// be validated by calling the Validate() method. /// </summary> /// <param name="context">The HTTP context associated with the current call.</param> /// <returns>An HTML string corresponding to an <input type="hidden"> /// element. This element should be put inside a <form>.</returns> /// <remarks> /// This method has a side effect: /// A response cookie is set if there is no valid cookie associated with the request. /// </remarks> public TagBuilder GetHtml([NotNull] HttpContext context) { var builder = _worker.GetFormInputElement(context); return(builder); }
/// <summary> /// Generates an anti-forgery token for this request. This token can /// be validated by calling the Validate() method. /// </summary> /// <param name="context">The HTTP context associated with the current call.</param> /// <returns>An HTML string corresponding to an <input type="hidden"> /// element. This element should be put inside a <form>.</returns> /// <remarks> /// This method has a side effect: /// A response cookie is set if there is no valid cookie associated with the request. /// </remarks> public HtmlString GetHtml([NotNull] HttpContext context) { var builder = _worker.GetFormInputElement(context); return(builder.ToHtmlString(TagRenderMode.SelfClosing)); }