RazorPageBase.SetAntiforgeryCookieAndHeader Method

Definition

Sets antiforgery cookie and X-Frame-Options header on the response.

C#
public virtual Microsoft.AspNetCore.Html.HtmlString SetAntiforgeryCookieAndHeader ();

Returns

An empty IHtmlContent.

Remarks

Call this method to send antiforgery cookie token and X-Frame-Options header to client before FlushAsync() flushes the headers.

Applies to

Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0