c# - What is .AspNetCore.Antiforgery.xxxxxxx cookie in .Net Core? -


i trying use validateantiforgerytoken in .net core getting .aspnetcore.antiforgery.xxxxxxx cookie missing.

what .aspnetcore.antiforgery.xxxxxxx cookie?

asp.net core looks cookie find x-csrf token.

the validateantiforgerytoken action filter requests made actions have filter applied blocked unless request includes valid antiforgery token.

in general asp.net core may token in cookie or header. may have situation when

  • instead of cookie header used pass token
  • cookie token has different name asp.net core expected.

by default, asp.net core generate , expect unique cookie name beginning defaultcookieprefix (".aspnetcore.antiforgery.").

this overriden using antiforgery option cookiename:

services.addantiforgery(options => options.cookiename = "x-csrf-token-cookiename"); 

if talking header, name specified by:

services.addantiforgery(options => options.headername = "x-xsrf-token"); 

look into:


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -