コード例 #1
0
 public static void SetCookie(this IInfrastructureAntiForgeryManager manager, HttpContextBase context, IIdentity identity = null)
 {
     if (identity != null)
     {
         context.User = new ClaimsPrincipal(identity);
     }
     context.Response.Cookies.Add(new HttpCookie(manager.Configuration.TokenCookieName, manager.GenerateToken()));
 }
コード例 #2
0
 public static void SetCookie(this IInfrastructureAntiForgeryManager manager, HttpResponseHeaders headers)
 {
     headers.SetCookie(new Cookie(manager.Configuration.TokenCookieName, manager.GenerateToken()));
 }