Ejemplo n.º 1
0
        /// <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 &lt;input type="hidden"&gt;
        /// element. This element should be put inside a &lt;form&gt;.</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);
        }
Ejemplo n.º 2
0
        /// <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 &lt;input type="hidden"&gt;
        /// element. This element should be put inside a &lt;form&gt;.</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));
        }