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);
public Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet GetAndStoreTokens (Microsoft.AspNetCore.Http.HttpContext httpContext);
abstract member GetAndStoreTokens : Microsoft.AspNetCore.Http.HttpContext -> Microsoft.AspNetCore.Antiforgery.AntiforgeryTokenSet
Public Function GetAndStoreTokens (httpContext As HttpContext) As AntiforgeryTokenSet

Parameters

httpContext
HttpContext

The HttpContext associated with the current request.

Returns

An AntiforgeryTokenSet with tokens for the response.

Remarks

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

Applies to