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

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -