IAntiforgery.GetAndStoreTokens(HttpContext) IAntiforgery.GetAndStoreTokens(HttpContext) Method

Definition

Generates an AntiforgeryTokenSet for this request and stores the cookie token in the response. This operation also sets the "Cache-control" and "Pragma" headers to "no-cache" and the "X-Frame-Options" header to "SAMEORIGIN".

public Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet GetAndStoreTokens (Microsoft.AspNetCore.Http.HttpContext httpContext);
abstract member GetAndStoreTokens : Microsoft.AspNetCore.Http.HttpContext -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet
Parameters
httpContext
HttpContext HttpContext

The HttpContext associated with the current request.

Returns

Remarks

This method has a side effect:
A response cookie is set if there is no valid cookie associated with the request.

Applies to